Home > Software engineering >  VB.net
VB.net

Time:09-20



Who can help me to solve, 600 the 1001011000 implantation into the D9 - do ten inside contact below,

Checkbox3 9 D true is 1, false to 0
'... "

Hope your advice

CodePudding user response:

 
Private Sub Command1_Click ()
Test 600
End Sub


Public Sub test (ByVal a As an Integer)
Dim iC As an Integer, iD As an Integer
Dim As Integer I
Do
IC=Int (a/2)
ID=a - iC * 2
The Debug. Print I, iD
'here, had to separate bit position and value, the next step is to fill chechkbox
'if you are using the vb control array, it is
The CheckBox (I) Value=https://bbs.csdn.net/topics/iD
'if you use is vb.net, you can drop the control in the collection, and then use a collection of index taking out the corresponding control assignment,
'of course, you want to use a case or a pile of the if also can fill in, small anyway, copy copy,
I=I + 1
A=iC
Loop While iC & gt; 0
End Sub


CodePudding user response:

 Dim iC As an Integer, iD As an Integer 
Dim As Integer I
X=600
Do
IC=Int (X/2)
ID=X - iC * 2
The Debug. Print (I, iD)
CheckBox3. Checked=iD
CheckBox4. Checked=iD
CheckBox5. Checked=iD
CheckBox6. Checked=iD
CheckBox7. Checked=iD
CheckBox8. Checked=iD
CheckBox9. Checked=iD
CheckBox10. Checked=iD
CheckBox11. Checked=iD
CheckBox12. Checked=iD
I=I + 1
X=iC
Loop While iC & gt; 0

See, I wrote this, seems to be no

CodePudding user response:

I am using VB.net

CodePudding user response:

Every time I take a loop, you one-time assignment all wrong, of course, according to the value of the I determine which the checkbox, and then according to the iD assignment

CodePudding user response:

 On Error GoTo Err 
Dim iC As an Integer, iD As an Integer
Dim I As Integer=0
X=Val (TextBox4. Text)
If X & gt; Then 1023
Err: MessageBox. Show (" out of scope, please input again!" , "serial communication error", MessageBoxButtons. OK, MessageBoxIcon. The Exclamation)
End the If
Do
IC=Int (X/2) '2 iC integer times of 0
ID=X - iC * 2 '
'the Debug. Print (I, iD)
'Next
I=I + 1
If I=1 Then CheckBox12. Checked=iD
If I=2 Then CheckBox11. Checked=iD
If I=3 Then CheckBox10. Checked=iD
If I=4 Then CheckBox9. Checked=iD
If I=5 Then CheckBox8. Checked=iD
If I=6 Then CheckBox7. Checked=iD
If I=7 Then CheckBox6. Checked=iD
If I=8 Then CheckBox5. Checked=iD
If I=9 Then CheckBox4. Checked=iD
If I=10 Then CheckBox3. Checked=iD
'I=I + 1
X=iC
Loop While iC & gt; 0

I have succeeded,

In the text box, enter Numbers, every time I enter a number, the cursor ran to the left, I hope that after the cursor on the right side, as shown in figure, I will continue to write 537

CodePudding user response:

The effect is not very good,
I'll textbox4. Inside the text input is a variable input values, the following D9 - D0 will correspond to the binary,
Feel the cycle running is not very good, if I were to enter a new value

CodePudding user response:

Every time to enter a new value is not out of the new results, cycle run is CPU running you didn't run, what do you love CPU

CodePudding user response:

I type 12, haven't finished input, the cursor ran to the left, and I want to keep the cursor in the back waiting for me, I may also input is 123

CodePudding user response:

Is you what happened in the text frame's change event,
Guess the past also want to enter the Numbers you what all don't automatically immediately the result immediately, the operation is usually in a fixed input digits, such as detection to input two began operation input a don't do any processing,
Like you input digits of uncertain demand, should be given by the operator after the completion of the input a sign of an input to complete, such as clicking on a button, blow with a carriage return, or press the TAB what make the text box loses focus,