By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,939 Members | 1,670 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,939 IT Pros & Developers. It's quick & easy.

How to replace an Integer value with a String value?

P: 2
Hey, everyone first time so bear with me if something looks odd. Im working with a file and need to set the value of a variable from an integer(which it is in the file) to a String(to be consoled out). Im recieving an error in the if statments. Am I on the right track or is there another way of doing it? Any help would be great. Att: is the vb program of what i have so far.Thanks
Attached Files
File Type: txt vb3.txt (2.7 KB, 335 views)
Dec 8 '10 #1
Share this Question
Share on Google+
2 Replies

P: 5
You've got quite a few problems here. You're dimensioning dStateID as an integer, and then assigning a string value to it. That will give you an error every time. Plus, the dStateid variable is local to the initialization procedure, which means it will never be seen by the rest of the program.

Also, you're combining a case statement with an if-else, which is counter productive and confusing. Just make each decision a case. Look up the help on select case to get the syntax right, since using "select case true" makes no sense at all.
Dec 8 '10 #2

P: 2
Thanks For the reply.I understand that I am getting an error but, i really don't know how to write it. The problem is that in the file, the dstateid variable is an integer and my professor wants me to console it to the name "Illinois" and 168 to "Ohio" etc.(see the 'If' 'Then' statements). This is what I'm trying to accomplish. I have removed the dstateid from local to the main module and edited the Select Case statements to IF ones.
Attached Files
File Type: txt VBedit.txt (2.5 KB, 334 views)
Dec 10 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.