Results 1 to 10 of 10

Thread: if then - text to labelbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Location
    London, Uk.
    Posts
    72

    Question if then - text to labelbox

    I've another problem - what is the best way to implement this?

    desired text is read to label1.caption (this part working), now if the label1.caption has the words intranet in it then label6 should contain technology is firewall. I tried an if then statement after the .txt was read to label1.caption.

    Thanks.

  2. #2
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    VB Code:
    1. If InStr(Label1.Caption, "Intranet") > 0 Then Label6.Caption = "technology is firewall"
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  3. #3
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    note the InStr function actually returns the character postition of the word searched for in the string specified usually, or zero if it wasnt found
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Location
    London, Uk.
    Posts
    72

    Thumbs up

    Brilliant - its working, now i need to apply this to the other label boxes within the forms, which will take a while!

    Appreciated & grateful - Thanks a lot!

  5. #5
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    cool
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Location
    London, Uk.
    Posts
    72
    Sorry - one other query:

    what if label1 contains the text intranet and extranet, or just intranet or just extranet, I tried this but not working:

    If InStr(Label1.Caption, "Intranet") and _
    (Label1.Caption, "extranet") > 0 Then
    Label6.Caption = "firewall."

    End If

    If InStr(Label1.Caption, "Intranet") or _
    (Label1.Caption, "extranet") > 0 Then
    Label6.Caption = "firewall."

    End If

    Whats the best way to implement this?

    Thanks.

  7. #7
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    just a quick question, can you just use the .Text property or are these values always going to be in the middle of someother text.....?
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Location
    London, Uk.
    Posts
    72
    Not too sure what you mean:

    my project is this: q1 form: what do you use the internet for with checkboxes and selected ones are stored to q1.txt, q2 form: what technologies do you use with checkboxes and selected ones are stored to q2.txt, q3 form: what legal laws do you know/use with checkboxes and selected ones are stored to q3.txt - eventually user comes to the recommendation form, which the selected answers to q1,2,3 forms are read to the label boxes, so depending on what internet use, then with if then statements i recommend other technologies and legal laws they should use.

  9. #9
    Myrrdan
    Guest
    Originally posted by P Lee
    Sorry - one other query:

    what if label1 contains the text intranet and extranet, or just intranet or just extranet, I tried this but not working:

    If InStr(Label1.Caption, "Intranet") and _
    (Label1.Caption, "extranet") > 0 Then
    Label6.Caption = "firewall."

    End If

    If InStr(Label1.Caption, "Intranet") or _
    (Label1.Caption, "extranet") > 0 Then
    Label6.Caption = "firewall."

    End If

    Whats the best way to implement this?

    Thanks.
    Don't you need to declare each section of the if statement? like so

    if intStr(Label1.caption, "intranet") > 0 or instStr(lable1.caption,"extranet") > 0 then

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Location
    London, Uk.
    Posts
    72
    Thanks, my proj is turning out to be a nightmare, with all the different recommendations of technology, legal laws, what should contain in the risk assessment, policy plan depending on what the internet use was chosen!

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