English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a small problem, i have a database and the database is connected with ado. Anyways in vb i can edit, move bk n forth with records etc. Now say i link a textbox to my db i want to basically have another text box so when the firstbox has a certain value the second one will change e.g Say the program runs, as the first customer comes up and he has a code say 50000, can i make another text box check the value in that text box and if its 50000 it will display say £4.50? I was thinking something on the lines if

If blabla.text = 50000 then
blabla.text = "4.50"
end if
end sub

but this doesnt work, it doesnt update itself, also i want the value to change as i skip though records, i dont want ti to change on the first record and stay like that thoughout

2007-05-06 11:30:21 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

Your code is modifying the text property of a text box on the form. The Textbox display will not get updated on the form(screen) while the proceedure is running.

You need to let your code allow the textbox to be redrawn while your loop is executing. This is done by calling the DoEvents method, this will allow your code to pause and handle any other events which have happened while the loop has been executing.

FOR X= 1 TO 3000
label1.text = X
My.Application.DoEvents()
NEXT

The above example calls DoEvents and allows the label1 to be redrawn on the screen with an updated text property. If you comment out this command then the loop will still function but you will not see each number as its entered into the lable text property. Instead it would only show the final updated value as the code finishes executing.


EDIT:
If textbx1.text = 50000 then
textbox2 = "4.50"
else
textbox2.text = textbox1.text
End if

This IF ELSE will allow the textbox to change AND reset it back.

2007-05-06 17:39:52 · answer #1 · answered by MarkG 7 · 0 0

this may well be a annoying question to respond to without knowning no be counted in case you comprehend any programming langauge or no longer, yet i'm going to offer it a circulate. Dim - it is the main-word for a variable statement in case you pick to keep some value in a variable to be utilized in a later step of your programming then initiate with Dim. precise after which you should positioned the variable call like firstname. What does first call must be? properly many times you will make a popularity out of a chain of charcters additionally prevalent as a string. subsequently you at the instant have a line of code like this: Dim firstname As String in case you pick to assign a cost to the string then you somewhat say firstname = "John" on your different questions an integer is a quantity type variable. occasion: Dim countofpeople As Integer countofpeople = 6 Boolean is a real or fake variable type Dim isdone As Boolean idone = genuine i'm hoping this facilitates

2016-10-04 11:37:15 · answer #2 · answered by ? 4 · 0 0

You have to aprouch this problm from a different angle. Create an event on the text box that is changing the value. Say change event, and in this event do your checking code.

2007-05-06 12:14:50 · answer #3 · answered by Bohdan 2 · 0 0

Sounds to me like you are not iterating through your recordsets correctly. Also, it seems like you are looping back the same control name (blabla) as both the source and destination.

Assuming you are using a DataReader named objReader to get the records and iterate them:

textbox1.text = objReader("customercode")
Select Case objReader("customercode")
Case "50000"
textbox2.Text = "4.50"
Case Else
textbox2.Text = "undefined"
End Select

2007-05-06 14:20:50 · answer #4 · answered by Anonymous · 0 0

fedest.com, questions and answers