5 Replies - 2190 Views - Last Post: 15 March 2013 - 12:00 PM Rate Topic: -----

#1 koppong  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 12-March 13

same value displaying in different textboxes. This isn't my intent

Posted 15 March 2013 - 10:10 AM

I want each box to contain different values when a user select a different cell in a listview and clicks on the button.
for instance: If I check Checkbox1, a listview is opened. Then I select cell 'a'=ABC in the listview, the value is put in label5. And when I click on button1, the value ABC is placed in the txtLeak.
Now I select checkbox2, and I select cell 'D' = KEF, the value is put in label 5. And when I click on button1, the valued KEF is placed in txtSidescatter
But this code displays the same value in each checkbox:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Form1.CheckBox1.Checked = True Then
Form1.txtLeak.Text = Label5.Text
End If
If Form1.CheckBox2.Checked = True Then
Form1.txtSidescatter.Text = Label5.Text
End If
If Form1.CheckBox3.Checked = True Then
Form1.txtLeakageSideScatter.Text = Label5.Text
End If
If Form1.CheckBox4.Checked = True Then
Form1.txtForwardBackscatter.Text = Label5.Text
End If
If Form1.CheckBox5.Checked = True Then
Form1.txtLeakageForward.Text = Label5.Text
End If
Close()

End Sub 

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: same value displaying in different textboxes. This isn't my intent

#2 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: same value displaying in different textboxes. This isn't my intent

Posted 15 March 2013 - 10:47 AM

OK, I guess the site crashed yesterday, and the restore lost some messages.

Anyway, Your code says "put the text contained in Label5.Text, into one or more TextBoxes". It will put the same value into every TextBox that has an associated CheckBox checked.

Read through your code. If CheckBox1 is checked, it will put the contents of Label5.Text into txtLeak.Text, which is what you want it to do, if ChekBox1.Text is checked.

Now, when you click on CheckBox2, is CheckBox1 still checked? If so, it will put the new value into txtLeak.Text, and then, it will put the same value into txtSidescatter.Text. As long as the CheckBoxes remain checked, all the TextBoxes associated with them will receive the same value.

You do know, don't you, that a CheckBox is not like a RadioButton. When you check a CheckBox, it does not uncheck any other CheckBoxes.
Was This Post Helpful? 0
  • +
  • -

#3 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: same value displaying in different textboxes. This isn't my intent

Posted 15 March 2013 - 11:00 AM

View Postlar3ry, on 15 March 2013 - 01:47 PM, said:

OK, I guess the site crashed yesterday, and the restore lost some messages.


Actually, it's still here, this is a new topic from the one you've already been helping the op with. Original
Was This Post Helpful? 0
  • +
  • -

#4 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: same value displaying in different textboxes. This isn't my intent

Posted 15 March 2013 - 11:02 AM

Why don't you read all the replies in the first topic you posted, instead of opening a new one?

View PostCharlieMay, on 15 March 2013 - 12:00 PM, said:

View Postlar3ry, on 15 March 2013 - 01:47 PM, said:

OK, I guess the site crashed yesterday, and the restore lost some messages.


Actually, it's still here, this is a new topic from the one you've already been helping the op with. Original

Just spotted that. He changed the title, so I didn't find it until I was scanning down for topics I was following.
Was This Post Helpful? 0
  • +
  • -

#5 koppong  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 12-March 13

Re: same value displaying in different textboxes. This isn't my intent

Posted 15 March 2013 - 11:51 AM

You right!, I figured it out but bereft of idea. If anyone has an Idea about how to go by it. For the textboxes must be filled and the values summed up.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9059
  • View blog
  • Posts: 34,018
  • Joined: 12-June 08

Re: same value displaying in different textboxes. This isn't my intent

Posted 15 March 2013 - 12:00 PM

Closing duplicate topic. Please do not create more.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1