|
Until you sign up you can't do much. Yes, it's free.
|
|
|
|
|
|
|
 | / / / Viewing Topic
|  |
( SilverDragon1Wings )
Executive
|
When I ran the debugger for VB, after writing in my code, it gave me several errors that I don't know how to fix. The errors involve the statement I made for what to say after the command button is clicked. Here is the sentence I wrote: 'create message message = "You have entered " firstName & " " & lastName & " as a new customer." vbCR firstName & "'s address is: " & streetAddress & "," & city & "," & state & "," & zipCode & "." THE TWO indented areas indicate the start of the lines {meaning that in the program it only takes up two lines} the & sign {after firstName} which connects the statement of variables and string literals together has an error that reads "Method arguments must be enclosed in parentheses" Then for the same sign, there is another error "Expression is expected." for the string literal 'firstName' the error reads "Expression is not a method." And the last error reads "End of statement expected" for the first line of my sentence. How do I fix these errors? I wrote the sentence out how I was instructed to by my professor, did I make an error in writing it? {She didn't give the exact sentence to write, just how to write it.} HELP!
|
|
|
Ethryx
Visionary
Patron
|
You need an & right before the variable firstname
------- Nobody can go back and start a new beginning, but anyone can start today and make a new ending
|
8:21 pm on Feb. 14, 2008 | Joined Jan. 2007 | 232 Days Active Join to learn more about Ethryx New York, United States | Straight Male | 3595 Posts | 8261 Points
|
|
| |
|
|
helloangel666
Quality Control Engineer
|
okay
------- guys wit long hair rock!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ethryx
Visionary
Patron
|
Okay, I figured it was .NET since you said you were taking a class on VB and they hardly teach the older versions anymore haha. But here is a working example of what you need: | Code: | Dim Message As String, firstName As String, lastName As String, streetAddress As String, city As String, state As String, zipCode As String firstName = "Joe" lastName = "Smith" streetAddress = "123 Popcorn Street" city = "Bigville" state = "NY" zipCode = "11777" Message = "You have entered " & firstName & " " & lastName & " as a new customer." & vbCrLf & firstName & "'s address is: " & streetAddress & "," & city & "," & state & "," & zipCode & "." MsgBox(Message) |
------- Nobody can go back and start a new beginning, but anyone can start today and make a new ending
|
8:38 pm on Feb. 14, 2008 | Joined Jan. 2007 | 232 Days Active Join to learn more about Ethryx New York, United States | Straight Male | 3595 Posts | 8261 Points
|
|
| |
|
|
( SilverDragon1Wings )
Executive
|
Yea, that is basically the code that I wrote for it, minus a few things. The whole concatenate thing confuses me though, which is why I had all of those errors.
|
|
|
Ethryx
Visionary
Patron
|
Well, just think of it like a math problem. If I told you A + B = C, that makes sense. But if I said A B = C, then you really aren't sure what to do with A and B to get the answer, C. You could assume multiply them but what if they were numbers, like 15 20 = C. You wouldn't really know what to do with them to get that answer -- C. So, in Visual Basic, always use & when you are going back and forth between variables and strings. If you ever get weird errors like you were getting earlier, just double check your coding and see if you missed any &'s where you need them. You'll get the hang of it
------- Nobody can go back and start a new beginning, but anyone can start today and make a new ending
|
8:48 pm on Feb. 14, 2008 | Joined Jan. 2007 | 232 Days Active Join to learn more about Ethryx New York, United States | Straight Male | 3595 Posts | 8261 Points
|
|
| |
|
|
|
| Looking for something else?
|
|
|
|
|
|
 | / / / Viewing Topic |  |
|