Help with code

Discussion in 'Questions (Windows Mobile)' started by cdeane, Sep 21, 2007.

  1. cdeane

    cdeane Member

    I have four rows of text boxes(4 textboxes per row).One textbox in each row
    has a value of 100 for as a defalt(will never change).
    After the program runs all other textboxes will have a value from 0 to well in
    the hundreds.Only one of these rows will have all the textboxes in the range
    of 0 to 100.All I need is that row with the values of 0 to 100.

    Here is how I would like to do it but for obvious reasons cant happen.This is were i need your help.

    If textbox1.text=<100 and
    textbox2.text=<100 and
    textbox3.text=<100 then
    Else If textbox5.text=<100 and
    textbox6.text=<100 and
    textbox8.text=<100 then
    Else If ect.,ect.,get the point

    As you see textbox4 and textbox7 already has a defalt value of 100 so there not needed here.And I will have a form for each row to reside in(4 in total).
    Ive got this part covered.Its the example sateted above that is my only draw back.
  2. Cableguy

    Cableguy Expert Licensed User

    instead of nested ifs you could use case select...

    Still I dont underrstand your question exactly, as your description is very complete but ab bit confusing....I guess you want to know when to show the form for the un-altered row?
  3. cdeane

    cdeane Member

    Food for thought:It looks like this before run time.

    100 0 0 0
    0 100 0 0
    0 0 100 0
    0 0 0 100

    When done it look like this:

    100 47 753 301
    215 100 162 650
    13 6 100 40
    33 15 250 100

    Or this:

    100 8 246 7
    132 100 325 96
    41 3 100 3
    138 104 340 100

    And so on and so on.
    Last edited: Sep 21, 2007
  4. Cableguy

    Cableguy Expert Licensed User

    An what you what to do is to show a form acordingly to what row has all values above 100, yes?

    What if two rows have their values above 100?

    For the first part you can use the ensted if as they work fine with this...for the second is a bit more complicated...
    basically you need to teste wich rows are above 100, and maybe the highest values?
  5. cdeane

    cdeane Member

    Equal to 100 or below to 0 and above
  6. Cableguy

    Cableguy Expert Licensed User

    I think you mean =<100 And =>0,yes?
    have you thought about having more than one row with valid result to this expression?
  7. cdeane

    cdeane Member

    Meaning only between and equal to 0 and only 100.

    If you look in each example you can see it.
  8. cdeane

    cdeane Member

    yes,and it works just fine until i hit my nimas 0 then it out the door
  9. agraham

    agraham Expert Licensed User

    Does this do what you want? The textboxes are named according to their row and column. Depending upon the exact use the comparison of Text to the number 100 should probably be made a bit more rigorous by explicitly converting the text to a number rather than relying on an implicit conversion that may throw an error under some circumstances.
    Sub GetLowRow
    For Row = 1 To 2
          Count = 
    For Col = 1 To 4
             w = 
    "TextBox" & Row & Col
    If Control(w).Text <= 100 Then
                Count = Count + 
    End If
    If Count = 4 Then
    Return Row
    End If
    Return -1
    End Sub
  10. cdeane

    cdeane Member

    Ok,I think I know were this is going.It looks promising.I may need some time to to play with it.(I am new to this).I was all about spreadsheets at one time.

    Last edited: Sep 22, 2007
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice