[C#] make MultiIcon Class to work with 256x256 png's

Discussion in 'Mixed Languages' started by FreeStyler, Jul 30, 2012.

  1. stevemk14ebr

    stevemk14ebr MDL Senior Member

    Jun 23, 2010
    267
    48
    10
    heres the project click change pic type something in the backspace it all and the button will still be enabled here
    btw it's vb.net
     
  2. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    6,218
    22,277
    210
    It makes no difference my good man, you used 4 :)
     
  3. FreeStyler

    FreeStyler MDL Guru

    Jun 23, 2007
    3,557
    3,832
    120
    #23 FreeStyler, Aug 2, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    @stevemk14ebr, changes below make it work, seems most of the glitch was caused by the ElseIf statement

    before:
    Code:
        Public Sub disablecheck()
            'if the textbox has nothing in it and the picturebox has nothing in it then disable button 
            If TextBox1.Text = String.Empty And PictureBox1.Image Is Nothing Then
                Button1.Enabled = False
                'else if textbox length is longer than 0 characters and picturebox1.image is something then enable
                'when the textbox is filled and then all characters backspaced this check fails, i don't know why because this checks for all possible characters?
            ElseIf Not String.IsNullOrWhiteSpace(TextBox1.Text.Trim) And Not PictureBox1.Image Is Nothing Then
                Button1.Enabled = True
            End If
        End Sub
    after:
    Code:
        Public Sub disablecheck()
            'if the textbox has nothing in it and the picturebox has nothing in it then disable button 
            If String.IsNullOrWhiteSpace(TextBox1.Text.Trim) And PictureBox1.Image Is Nothing Then
                Button1.Enabled = False
            Else
                Button1.Enabled = True
            End If
        End Sub
     
  4. stevemk14ebr

    stevemk14ebr MDL Senior Member

    Jun 23, 2010
    267
    48
    10
    #24 stevemk14ebr, Aug 2, 2012
    Last edited by a moderator: Apr 20, 2017
    ok your not going to believe this but my "and" operator is acting like and "or" and the "or" like an "and". so when i use the code
    Code:
    If (String.IsNullOrWhiteSpace(TextBox1.Text.Trim)) Or (PictureBox1.Image Is Nothing) Then
                Button1.Enabled = False
            Else
                Button1.Enabled = True
    End If
    it works as you would expect if there were an "and" operator in there-instead of the or that is currently there

    but when i use the code
    Code:
    If (String.IsNullOrWhiteSpace(TextBox1.Text.Trim)) and (PictureBox1.Image Is Nothing) Then
                Button1.Enabled = False
            Else
                Button1.Enabled = True
    End If
    it works like you would expect and or operator to do- except with an and operator in

    is there a setting that could do this in vb express 2010 or is just a glitch/bug