while using the inputNumber field of antd, the data that i enter is changed to less than 2 or 1 without doing anything.
eg: if I enter input as 5, on the next moment it changes to 4, sometimes it goes upto 3 or 2. But this issue occurs randomly only.
Anyone please help
I need the correct value that I enter the input field
Related
The code I use is the following:
' (is on top of the listing directly after Public class form1)
Dim Score as Integer
...
Score=Val(Txtbox5.text) "Txtbox5 is control where I put in the value."
Lbl2.text=score "Lbl2 is the label where the score must display."
Txtbox5.text="" "Makes the Textbox empty."
Then the problem occurs: when I enter a new value in Txtbox5.text the I want this value update
the value in the label with the value that is already in the label by the score.
The code I use therefor is Lbl2.text=score +score but whats happend is the score in the label is double???
So what I want is: when I have a value in the label say 2 and I insert a new value in the textbox
say 3 then I want to see in the label a value of 5.
But I have tried everything but nothing works
Is there somebody who can help me with this problem??
If I understand you correctly you want to sum the current value of the TextBox5 to the Score variable and then update the label
This could be simply resolved without any thinking with
Score += Val(Textbox5.Text)
Lbl2.text=Score
Txtbox5.Text=""
But you could meet some problems because in your textbox the user can type anything, not just a number. In that context the Val function from the Microsoft.VisualBasic compatibility assemble doesn't tell you anything, simply converts the non numeric string to zero. This could be acceptable or not depending on your requirements. If you want to have a message for your user when the input is not good you could write
Dim currentInput as Integer
if Not Int32.TryParse(Txtbox5.Text, currentInput) Then
MessageBox.Show("You should input a numeric value!")
Else
Score = Score + currentInput
Lbl2.text=Score
Txtbox5.Text=""
End If
I have tried everything but nothing works
That's not strictly true..
Lbl2.Text = (Convert.ToInt32("0"&Lbl2.Text) + Convert.ToInt32(Txtbox5.Text)).ToString()
ps;
Your life would be a lot simpler if you used a couple of numericupdown controls, one readonly and no border etc to look like a label. Then life would be like:
resultNumericUpDown.Value += inputNumericUpDown.Value
Whenever you're asking the user for numbers, using a NUD saves a lot of headaches
I am automating a form using selenium in Internet Explorer 11. There is a field which accepts 5 characters max. When I try to enter 2 characters the cursor still shows in that field and enter data of other field and no error shows for this. It is working fine in other browsers.
E.g Field 1 (max accept 5) e.g sendkeys(12)
field 2 e.g sendkeys(456)
When I run code in field 1 it insert 12456 and insert nothing in next field.
I've this form and everything works perfect, when the user complete the form all the parameters go to the database and I can show them back, but I've a little problem with something. I've been inserting one field from codebehind like a constant, one of my fiel expect a int value but in the form you select that value as string. For example you select "Pink" in the form but the data base is expecting a int value. The table from Pink has Pink associated to a idValue, e.g. IDColor = 45 Color=Pink. So, what I really need to do is be able to send the ID associated with Pink to the database and when I call back that row, I need to show PInk instead of 45. I know how to make the connection, but I don't know hoy to make the consult. Thanks for your time for reading this and sorry for the long post.
This is the code for insert in the database after the form is ready
cmd.Parameters.Add(New SqlClient.SqlParameter("#IdColonia", 2))
I need to change that "2" for the ID associated with the parameter in the form.
This is the callback for this particular field
Me.txtDirColonia.Text = Me.gridDatos.Rows(Me.gridDatos.SelectedIndex).Cells(7).Text
I call back the ID of the table but I need the actual Color.
I have a panel with about six controls on the panel. I wanted to remove the controls from the panel and finally did so with MyPanel.Clear(). But before that I tried the following code that runs from a button click:
For Each b As Control In MyItem.MyPanel.Controls
MyItem.MyPanel.Controls.Remove(b)
Next
I would click the button and watch it, as well as the MyItem.MyPanel.Controls.Count in debug. As it went through, the count would reduce: to 5 to 4 to 3, then it would exit. If I clicked the button again it would remove two more, then the last one on the third click, so they all fit the bill and were all removed without changing anything. Why did it take three clicks? I'm obviously missing something simple here, I think, but I don't know what it is, and I'd really like to understand it. If I had to remove specific controls, it looks like I would have had a problem.
I ran into this issue myself and its odd it even lets you do it as you're modifying the collection in the loop you are referring to.This should be a better method.
If you like to remove them based on type
For i = Panel1.Controls.Count - 1 To 0 Step -1
If TypeOf Panel1.Controls(i) Is Label Then
Panel1.Controls.Remove(Panel1.Controls(i))
End If
Next
Odd that VB.NET even lets you do this, but essentially what you are doing is editing the collection you are iterating through. To better understand, pretend you are using a regular for loop from 1 to 6, at the first iteration you are removing object 1, leaving you with 5 objects, making the old number 2 object the first. The next iteration you remove the 2nd thing, which used to be the third, and so on. Most languages this is a run-time error.
What is happening is that you are deleting the controls starting from the first position and moving to the last. If the list has 6 records and you start deleting them like you are, programatically you are saying:
remove(0)
remove(1)
...
remove(5)
While you are doing that, the list is getting smaller. Once you delete the first item it drops from 6 positions to 5, then 4, then 3, etc. So midway through your code it tries to remove item at location 3 (4th item), but since you already removed 3 items, the list's size only contains 3 items and that position does not exist.
To properly remove them all, you would have to start at the back of the list and move to the front.
Perhaps something like:
For i As Integer = (MyItem.MyPanel.Controls.Count- 1) To 0 Step -1
MyItem.mypanel.Controls(i).Dispose()
Next
I have to make a "Do - while" input from a TextBox in Visual Basic. I mean I get some value for the amount of the numbers the user should type, and then I have to get this quantity of numbers from a textbox. I suppose the event is on TextBox1_KeyPress() but then the event is true even when I type in 0 for example and this way I won't be able to write the whole number, but the first digit. I want to be able to type in the whole number and then when I press Enter the value from the txtBox goes in some variable and cleans itself to write the next one.
Anyone who has any ideas? I'm really new in VB, sorry :(
dont use key_press. use key_up. in event args you will find keycode. for enter the code is 13. so when keycode = 13, extract textbox1.text to a variable. then clear the text box like textbox1.text = "". when ever you do this, increment a member variable by one. by that variable you will know how many values have been entered.