[Year 12 SofDev] vb.net error

ATKINSON-BUCK, Damien Damien.ATKINSON-BUCK at ivanhoe.com.au
Thu Jun 10 15:47:51 EST 2010


Hi folks,
            I’m just starting VB.Net with my year 11’s and have only ever used vb 6 before. The following code doesn’t make sense to me
I’m trying to just teach if else statements so using a couple of check boxes want the font in a textbox to change. In vb 6 you used to just say textbox1.fontbold=true and txtfontItalic = true not it seems totally different
[cid:image001.png at 01CB08B4.48A7C0C0]
    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
        Dim fnt As Font
        fnt = txtSomeWriting.Font
        If chkItalics.Checked = True And chkBold.Checked = True Then
            txtSomeWriting.Font = New Font(fnt.Name, 8, FontStyle.Bold Or FontStyle.Italic)
        ElseIf chkBold.Checked = True Then
            txtSomeWriting.Font = New Font(fnt.Name, 8, FontStyle.Bold)
        ElseIf chkItalics.Checked = True Then
            txtSomeWriting.Font = New Font(fnt.Name, 8, FontStyle.Italic)
        Else
            txtSomeWriting.Font = New Font(fnt.Name, 8, FontStyle.Regular)
        End If

    End Sub

I don’t get why it is only working if I have an OR between the 2 fontstyles, not an AND when I am trying to make the textbox Bold Italic

Does anyone have any ideas? Thanks in advance.
Regards
Damien

Damien Atkinson-Buck
Member of Academic Staff (Secondary)
________________________________

[cid:image002.jpg at 01CA7D93.5FFD22D0]<http://myivanhoe.net/>



PO BOX 91 The Ridgeway, Ivanhoe, Victoria 3079 Australia
Telephone +61 3 9490 3848 Facsimile +61 3 9490 3490
mailto:damien.atkinson-buck at ivanhoe.com.au
http://myivanhoe.net<http://myivanhoe.net/>









Privacy, Virus and Copyright Warning

The information contained in this electronic message (e-mail), and any files transmitted with it:

* is intended for the named recipients only. If you have received this in error, please advise the sender and delete it and any copies immediately;
* Any personal information in this email must be used in accordance with the Privacy Act 1988 and this always applies even if it has been sent to you in error.
* represents the views of the sender and does not necessarily represent the views or formal advice of Ivanhoe Grammar School;
* may be subject to Copyright, so no further use should be made of it without the author's permission.

The School does not represent or warrant that the email or any files attached do not contain errors or are free from computer viruses or other defects nor does it accept responsibility for any loss or damage resulting directly or indirectly from the use of the email or any attached files.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20100610/cdb0da7d/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 21432 bytes
Desc: image001.png
Url : http://www.edulists.com.au/pipermail/sofdev/attachments/20100610/cdb0da7d/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 9302 bytes
Desc: image002.jpg
Url : http://www.edulists.com.au/pipermail/sofdev/attachments/20100610/cdb0da7d/attachment-0001.jpg 


More information about the sofdev mailing list