|
-
Jul 14th, 2002, 07:39 PM
#1
Thread Starter
New Member
MOre basic VB questions - Text Box control
Thanks to the VB GURUs for help on my previous text box question. Here is another one for ya! Say I have three text boxes that I input info into: A, B, and C. Say I also have three text boxes: 1, 2, and 3 that the info. I put in the first three goes into them as follows:
Input from A goes to 1
Input from B goes to 2
Input from C goes to 3
For the purposes of boxes B and 2, I am not doing anything, but taking input from B and putting it in 2. That works fine. My problems are with A and C and 1 and 3. The best way to illustrate is with an example:
Part A: input works
Every time I input new values for boxes A, B, and C, this new input should be generated on a new line in boxes 1, 2, and 3 as follows:
Text Boxes Text Boxes
A B C 1 2 3
input from me: 1 3 5 fills boxes: 1 3 5
input from me: 5 7 8 fills boxes: 5 7 8
input from me: 9 14 96 fills boxes 9 14 96
Part B: input problem
If a new line of input to A and C is like below (value in A matches what is in 1 but the value in C does not match what is in 3) or (value in C matches what is in 3 but the value in A does not match what is in 1), the followng below should happen:
Text Boxes Text Boxes
A B C 1 2 3
input from me: 1 3 5 fills boxes: 1 3 5
input from me: 5 7 8 fills boxes: 5 7 8
input from me: 4 7 8 Should produce error message
input from me: 5 7 12 Should produce error message
The first message should read: "Duplicate entry, the value of A <and it should pull out the value 5> exists on 8."
The second message should read: "Duplicate entry, the value of C <and it should pull out the value 8> exists on 5."
In both instances, these values are coming from boxes 1 and 3 which are what are getting filled by input from boxes A and C respectively.
I am using regular text boxes. Please help if you can.
Last edited by JEngh; Jul 14th, 2002 at 07:46 PM.
Jason Engh (CCDA, CCNA, CCNP)
-
Jul 14th, 2002, 08:19 PM
#2
Addicted Member
DO you have some code that you can post?
-
Jul 14th, 2002, 10:01 PM
#3
Member
im not sure if this is what you want or not, if not it might get you close enough
Do While Not bFound And L < List1.ListCount
If UCase(Left(List1.List(L), Len(Text1.Text))) = UCase(Text1.Text) Then
List1.ListIndex = L
bFound = True
End If
L = L + 1
Loop
If bFound then
'error msg here
Else
'add the text here
End If
The Programmers Credo -
Protect dumb-ass from himself.
-
Jul 15th, 2002, 10:01 PM
#4
Addicted Member
it might get you close enough
-
Jul 17th, 2002, 10:44 AM
#5
Thread Starter
New Member
Thanks! I will give that a shot. At least it is better than what I was coming up with!
Jason Engh (CCDA, CCNA, CCNP)
-
Jul 18th, 2002, 08:47 PM
#6
Thread Starter
New Member
Thanks to the VB gurus for their continued help. Now I have the textbox problem narrowed down. The following is the code:
Code for button I click to run the program, fill text boxes, and check if values are new or existing.
Private Sub Command1_Click()
If InStr(Text7.Text, Text1.Text) Then
Text4.Text = ""
Text4.Text = "Duplicate Destination Mac Address. Destination Address exists on port " + Text3.Text
ElseIf InStr(Text6.Text, Text3.Text) Then
Text4.Text = ""
Text4.Text = "Duplicate Destination Mac Address. Destination Address exists on port " + Text3.Text
Else
Text4.Text = ""
Text4.Text = "Unknown destination -- Flooding out all ports
except Port " + Text3.Text
Text5.Text = Text5 + Text2.Text + vbNewLine
Text6.Text = Text6 + Text3.Text + vbNewLine
Text7.Text = Text7 + Text1.Text + vbNewLine
End If
End Sub
Basically, I have two text boxes I enter text into. ( 1 and 2). 1 fills a second text box, Box A. 2 fills a second text box, Box B. This is done when I click the button I have (Command1_Click()). When I input new values, the boxes fill fine, when I input values already in the boxes, I get an error message. So far so good!!!
The problem is: If I have a new value I input in Box 2 and leave the corresponding value in Box 1 the same, I should get an error message, "sorry, the value in box 1 is really Box B". Instead I get the error message, "sorry, the value in box 1 is really box 2".
An example:
Box1 ________ Box2 _________
BoxA_________ BoxB__________
so as I fill in values in 1 and 2, and click the button, I get a listing
Box1_________ Box2___________
BoxA ___1 BoxB_____9
________2_____________8
________3_____________7
________4_____________92
(each line should match so
1 corresponds to 9,
2 corresponds to 8,
3 corresponds to 7, etc)
Now say I put a value of 2 in Box 1, a value of 33 in box 2, and click the button. I should get a message saying:
"sorry, the value in Box 1 is really 8".
Instead I get the message:
"sorry, the value in Box 1 is really 33.
(each line should match so 1 corresponds to 9, 2 corresponds to 8, 3 corresponds to 7, etc).
I hope someone can help. As always, the boxes are regular text boxes. Please help!
Jason Engh (CCDA, CCNA, CCNP)
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
|