954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Integer to string then 2 listbox

Hello everyone. I am new to this forum and new to visual basic. I am writing a program and all is well except for one problem that I cannot get over..

I have a integer, it is random... I need to convert it to a string so I can put it in a listbox. I have tried in every way I could find to put it in.. it just don't fit. :confused: Can anyone suggest how to enter the int in its current form or tell me how to convert it to a string? Thanks.

christiannmandi
Newbie Poster
3 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

send me the project....I'll check out the code for ya.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

not tried cstr() ??

then use listbox.additem method

1o0oBhP
Posting Pro in Training
445 posts since Dec 2004
Reputation Points: 16
Solved Threads: 6
 

Hi,
Try this:

listbox.additem str(adodc1.recordset("idnumber"))

or

listbox.additem format(integer,"nnnnnnnnn")

hope it work.

Newvbguy

NewVBguy
Junior Poster in Training
71 posts since Mar 2005
Reputation Points: 13
Solved Threads: 3
 

Thanks for the replys. I used..

listbox.additem format(integer,"nnnnnnnnn")

and it worked great. FINALLY!!!!!! :-)

Thanks again.

christiannmandi
Newbie Poster
3 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

Just a few for you

cstr() ' convert to string
ccur() ' convert to curreny
clng() ' convert to long
cint() ' convert to integer
cdbl() ' convert to double

and theres probably a few more if you google search!

1o0oBhP
Posting Pro in Training
445 posts since Dec 2004
Reputation Points: 16
Solved Threads: 6
 

Thanks much. I was looking for all the wrong things. :-) I appreciate your patience with newbs like myself.

christiannmandi
Newbie Poster
3 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

to convert an integer tot string use: cStr(123)

or: Format(123)

PVBert
Junior Poster in Training
61 posts since Mar 2007
Reputation Points: 10
Solved Threads: 5
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You