|
-
Jun 4th, 2010, 12:40 AM
#1
Thread Starter
Lively Member
simple Veriable problem
I have a program that assigns a text box label to a variable.
If Check22.Value = 1 Then
If Text53.Text = "" Then
Text53.Text = Text38.Text
photo1 = "text53.text"
GoTo 100
End If
End if
I am using this as a tag for the location of the photo I placed in text53. I want to be able to go back and delete the photo I placed in text53 when check22.value = 0
I have tried everything and VB won't take it. It wants to make "photo1" = "" instead of making text53 = ""
-
Jun 4th, 2010, 05:16 AM
#2
Re: simple Veriable problem
what is currently in text53 and text38?
It wants to make "photo1" = "" instead of making text53 = ""
your code does not try to make text53 = ""
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jun 4th, 2010, 06:29 AM
#3
Re: simple Veriable problem
Here is what you have
vb Code:
'ALWAYS INDENT YOUR CODE
If Check22.Value = 1 Then 'use vbChecked or vbUnChecked not 0 or 1
If text53.Text = "" Then
text53.Text = Text38.Text
photo1 = text53.Text 'remove the quotes
GoTo 100 'NEVER USE GOTO (unless you are adding error trapping)
End If
End If
If you want something to happen if check22 = 0 then why are you checking for it to equal 1? As you have it now, if it does not equal 1, nothing happens at all.
-
Jun 4th, 2010, 12:00 PM
#4
Thread Starter
Lively Member
Re: simple Veriable problem
Ok I will do my best to explain.
When check1 = 1 it copies the contents of text38 to text53
then it assigns Photo1 with "text.53.text" value ( so it can remember where it pasted the contents of text38)
When check1 = 0 it uses the value in Photo1 to go back and remove the contents of text53.
I will go a little further
I have a picture box with an image and check box
when check1 = 1 then it copies the location of that image to a Que for printing
if check1 = 0 then it removes it from the Que
Photo1 variable is just used as a book mark telling the program what to delete. Being as it holds a value like "text1.text" I need the code to tell the program to change the contents of the text1.text to "" and not the change the value of Photo1 to "".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|