[Year 12 SofDev] vb.net error

ATKINSON-BUCK, Damien Damien.ATKINSON-BUCK at ivanhoe.com.au
Fri Jun 11 10:01:51 EST 2010


Thank you Robert,
It certainly does make it confusing, especially when trying to teach normal AND/OR to students and then have to try and get into logical and/or issues like this ☺
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/>






From: Timmer-Arends [mailto:timmer at melbpc.org.au]
Sent: Thursday, 10 June 2010 5:40 PM
To: Year 12 Software Development Teachers' Mailing List
Subject: Re: [Year 12 SofDev] vb.net error

Hello Damien
I don't know for sure, but having just wrestled with vb.net for the first time myself I understand some of your frustrations. Many vb settings are built up from vb 'bit constants' that are 'added' together to produce some overall effect.
In your case it might be, for example, that fontstyle.bold = "0001 0000' (or whatever) and fontstyle.italics = "0000 0100".
When you AND them, therefore, you get '0000 0000', whereas OR would produce '0001 0100', which I imagine would set both styles.

Just a guess at this stage. Hope it helps.

Regards
Robert T-A
Brighton SC
----- Original Message -----
From: ATKINSON-BUCK, Damien<mailto:Damien.ATKINSON-BUCK at ivanhoe.com.au>
To: Year 12 Software Development Teachers' Mailing List<mailto:sofdev at edulists.com.au>
Sent: Thursday, June 10, 2010 3:47 PM
Subject: [Year 12 SofDev] vb.net error

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:image002.png at 01CB093B.E20F6010]
    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.
________________________________
_______________________________________________
http://www.edulists.com.au - FAQ, Subscribe, Unsubscribe
IT Software Development Mailing List kindly supported by
http://www.vcaa.vic.edu.au - Victorian Curriculum and Assessment Authority and
http://www.vitta.org.au/vce/studies/infotech/softwaredevel3-4.html
http://www.vitta.org.au  - VITTA Victorian Information Technology Teachers Association Inc




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/20100611/5992ff2c/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 9302 bytes
Desc: image001.jpg
Url : http://www.edulists.com.au/pipermail/sofdev/attachments/20100611/5992ff2c/attachment-0001.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 21432 bytes
Desc: image002.png
Url : http://www.edulists.com.au/pipermail/sofdev/attachments/20100611/5992ff2c/attachment-0001.png 


More information about the sofdev mailing list