Hey people!
I'm from Holland (The Netherlands) and new to this forum, I'm not 100% sure if I'm posting this thread in the correct subforum... plz forgive me if I don't
I have a little experience in Visual Basic .NET 2008
Currently I'm developing a program for my job in which you can follow a checklist for doing a certain procedure. With every step you have to click a checkbox and so on. It's saved in an XLS-file and blahblah, all irrelevant for my question.
I've got to the point that I'm almost pulling my hair here, because everything went fine so far with coding my program, but this simple thing I can't solve
What I'm trying to do is, change the BackgroundImage of a Button when you click on it. If it is Image1 at the time of clicking it should change to Image2, and vice versa.
My code:
What am I doing wrong? I googled, I searched this forum, I can't get it to work.
What I think is strange, is that when I just say Button2.BackgroundImage = CrossBW (without the IF - THEN part) it works!
I'm sure one of you here knows the simple solution to this!
Thanks in advance!!
I'm from Holland (The Netherlands) and new to this forum, I'm not 100% sure if I'm posting this thread in the correct subforum... plz forgive me if I don't
I have a little experience in Visual Basic .NET 2008
Currently I'm developing a program for my job in which you can follow a checklist for doing a certain procedure. With every step you have to click a checkbox and so on. It's saved in an XLS-file and blahblah, all irrelevant for my question.
I've got to the point that I'm almost pulling my hair here, because everything went fine so far with coding my program, but this simple thing I can't solve
What I'm trying to do is, change the BackgroundImage of a Button when you click on it. If it is Image1 at the time of clicking it should change to Image2, and vice versa.
My code:
VB.NET:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim CrossColor As Image
Dim CrossBW As Image
CrossColor = CheckList.My.Resources.Resources.cross_big
CrossBW = CheckList.My.Resources.Resources.cross_big_bw1
If Button2.BackgroundImage = CrossColor Then Button2.BackgroundImage = CrossBW
End Sub
What am I doing wrong? I googled, I searched this forum, I can't get it to work.
What I think is strange, is that when I just say Button2.BackgroundImage = CrossBW (without the IF - THEN part) it works!
I'm sure one of you here knows the simple solution to this!
Thanks in advance!!
Last edited: