fdg
Computer
- Mar 23, 2003
- 1
In a program I am writing, I want a form to appear, when you click a button, that shows a different picture depending on what button you push. I currently have the code written:
(form 1)
Private Sub Form_Load()
Open "c:\mun.txt" For Output As #2
Write #2, "0"
Close #2
End Sub
(command button 1, form 1)
Private Sub Command1_Click()
Open "c:\mun.txt" For Output As #2
Write #2, "1"
Close #2
Used.Visible = False
Used2.Visible = True
End Sub
(command button 2, form 1)
Private Sub Command1_Click()
Open "c:\mun.txt" For Output As #2
Write #2, "2"
Close #2
Used.Visible = False
Used2.Visible = True
End Sub
(form 2)
Private Sub Form_Load()
Open "c:\mun.txt" For Input As #2
Input #2, string
Text1.Text = string
If Text1.Text = "1" Then Picture1.Visible = True
If Text1.Text = "2" Then Picture2.Visible = True
If Text1.Text = "3" Then Picture3.Visible = True
If Text1.Text = "4" Then Picture4.Visible = True
If Text1.Text = "5" Then Picture5.Visible = True
If Text1.Text = "6" Then Picture6.Visible = True
If Text1.Text = "7" Then Picture7.Visible = True
If Text1.Text = "8" Then Picture8.Visible = True
If Text1.Text = "9" Then Picture9.Visible = True
If Text1.Text = "10" Then Picture10.Visible = True
If Text1.Text = "11" Then Picture10.Visible = True
Close #2
End Sub
When I do a runtime debug, no matter what button I push on form1, the same picture cames up on form2. Can anyone help me? Can I use the Load sub for this function?
(form 1)
Private Sub Form_Load()
Open "c:\mun.txt" For Output As #2
Write #2, "0"
Close #2
End Sub
(command button 1, form 1)
Private Sub Command1_Click()
Open "c:\mun.txt" For Output As #2
Write #2, "1"
Close #2
Used.Visible = False
Used2.Visible = True
End Sub
(command button 2, form 1)
Private Sub Command1_Click()
Open "c:\mun.txt" For Output As #2
Write #2, "2"
Close #2
Used.Visible = False
Used2.Visible = True
End Sub
(form 2)
Private Sub Form_Load()
Open "c:\mun.txt" For Input As #2
Input #2, string
Text1.Text = string
If Text1.Text = "1" Then Picture1.Visible = True
If Text1.Text = "2" Then Picture2.Visible = True
If Text1.Text = "3" Then Picture3.Visible = True
If Text1.Text = "4" Then Picture4.Visible = True
If Text1.Text = "5" Then Picture5.Visible = True
If Text1.Text = "6" Then Picture6.Visible = True
If Text1.Text = "7" Then Picture7.Visible = True
If Text1.Text = "8" Then Picture8.Visible = True
If Text1.Text = "9" Then Picture9.Visible = True
If Text1.Text = "10" Then Picture10.Visible = True
If Text1.Text = "11" Then Picture10.Visible = True
Close #2
End Sub
When I do a runtime debug, no matter what button I push on form1, the same picture cames up on form2. Can anyone help me? Can I use the Load sub for this function?