Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
3
Answers
Adding Double, String value on listbox.
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Song Lee
9y
677
1
Reply
Hello,
I'm trying to make listbox show a few string and double values when button is pressed.
However, I'm getting errors:
Cannot implicitly convert type 'string' to 'double'
When ever I put double agestr = ageText.Text;
How can I make it so agestr and teethstr text box only accepts double values?
private void
addButton_Click(
object
sender,
EventArgs
e)
{
string
namestr = nameText.Text;
string
agestr = ageText.Text;
//This needs to be double, not string
string
genderstr = genderList.Text;
string
teethstr = teethText.Text;
//This needs to be double, not string
string
tailstr = tailText.Text;
string
row =
String
.Format(
"{0} {1} {2} Has {3} teeth. tail is {4} cm long"
, namestr, agestr, genderstr, teethstr, tailstr);
listBox.Items.Add(row);
}
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
how to get latest record from multiple record of same employ
how to get list of latest record of all employee