Results 1 to 4 of 4

Thread: simple Veriable problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2010
    Posts
    80

    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 = ""

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: simple Veriable problem

    Here is what you have
    vb Code:
    1. 'ALWAYS INDENT YOUR CODE
    2. If Check22.Value = 1 Then 'use vbChecked or vbUnChecked not 0 or 1
    3.     If text53.Text = "" Then
    4.         text53.Text = Text38.Text
    5.         photo1 = text53.Text 'remove the quotes
    6.         GoTo 100 'NEVER USE GOTO (unless you are adding error trapping)
    7.     End If
    8. 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.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2010
    Posts
    80

    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
  •  



Click Here to Expand Forum to Full Width