|
-
Sep 28th, 2004, 03:31 PM
#1
Thread Starter
Lively Member
showing data retrieved in a msgbox
I need to show data that has been retrieved in a msgbox:
here is my code:
Try
tempCardNum = ds.Tables("cardInfo").Rows(0).Item("cardNum")
MsgBox("Card Found, The Details: " & cardNum & ", MsgBoxStyle.Critical")
Catch ex1 As Exception
MsgBox("Card Not Found - Any Problems Please Contact Your System Administrator")
End Try
where & cardNum & is, i need to show card number, but i also need to show date scanned...
not sure how to go about this...
thanks in advance
Last edited by escapegirl; Oct 13th, 2004 at 05:45 AM.
-
Sep 28th, 2004, 05:02 PM
#2
Frenzied Member
Is your tempCarNum getting set to the data that you want? If so, use that variable. If you need to retrieve other information, use the same technique.
-
Sep 28th, 2004, 05:18 PM
#3
Thread Starter
Lively Member
yes...
yes the tempcardnum does give the info i want, i am not sure how to actually add it to the line of code...
do i need the & tempcardnum & in there???
this is that part that is confusing the hell out of me hehehe...
-
Sep 28th, 2004, 05:25 PM
#4
Frenzied Member
Something like this
VB Code:
Dim tempCardNum As String = "Hello escapegirl"
MsgBox("Card Found, The Details: " & tempCardNum, MsgBoxStyle.Critical)
-
Sep 28th, 2004, 05:46 PM
#5
Thread Starter
Lively Member
thanks
thanks, what if i need three fields to show?
would it be seperated by comma's or &?
thanx
-
Sep 28th, 2004, 05:51 PM
#6
Frenzied Member
You need to concatenate you strings, so the ampersand. You could do like this
VB Code:
Dim field1 As String = "Hello"
Dim field2 As String = "there"
Dim field3 As String = "escapegirl"
MsgBox("Card Found, The Details: " & field1 & " " & field2 & " " & field3, MsgBoxStyle.Critical)
But that gets a little ugly to look at. You might want to do the same thing a different way, such as:
VB Code:
Dim field1 As String = "Hello"
Dim field2 As String = "there"
Dim field3 As String = "escapegirl"
Dim message As String = "Card Found, The Details: " & field1 & " " & field2 & " " & field3
MsgBox(message, MsgBoxStyle.Critical)
-
Sep 28th, 2004, 07:41 PM
#7
Thread Starter
Lively Member
mmmm not sure
would the above work if i was pulling the information from a database.
some history...
i am pulling 3 fields from a db - giftcard
i search on cardNum (select * where cardNum blah blah blah)
the three fields that come up are:
cardNum
assocID
dateScanned
this is the line of code i have for the above:
MySql1String = "select * from cardInfo where cardNum = '" & txbxGiftCardNumSearch.Text & "' "
Try
tempCardNum = ds.Tables("cardInfo").Rows(0).Item("cardNum")
MsgBox("Card Found, The Details: " & *********
Catch ex1 As Exception
MsgBox("Card Not Found - Any Problems Please Contact Your System Administrator")
End Try
where the * are is the point at which i need to pull the above fields. the above fields do store in tempcardnum...
hope this makes more sense...
any ideas???
-
Sep 28th, 2004, 07:52 PM
#8
VB Code:
messagebox.show("Card Found, The Details: " & tempCardNum")
or you could use a datareader if want to query in the database.
VB Code:
'lets assume that the first column of your table is cardNum
'cn is a connection
dim cm as new sqlcommand("select * from cardInfo where cardNum = '" & txbxGiftCardNumSearch.Text & "' ",cn)
dim dr as sqldatareader = cm.executereader
while dr.read
messagebox.show("Card Found, The Details:" & dr(0).tostring)
end while
dr.close
-
Sep 28th, 2004, 08:38 PM
#9
Frenzied Member
Whatever you want to do will work, don't ask, just try it. I hope you realize that in your code when you set tempCardNum, you're setting it to the value of a particular column in a particular row. Just do the same for any info you want to retrieve. Or do the same thing differently, it doesn't really matter.
Try?, try not. Do, or do not. There is no try.
Oh, and do a favor please. Please learn how to format your code. It will help anyone reading it, and it will help you to get good responses.
Mike
-
Sep 28th, 2004, 08:44 PM
#10
mike just calm down your getting burn. Maybe his really a stupid newbie..
me too...i accept that im also a stupid newbie..
-
Sep 28th, 2004, 08:45 PM
#11
Thread Starter
Lively Member
sorry...
Sorry about the formatting - i sometimes get carried away with the left align hehehehe
anyways,
i know that i am setting the tempCardNum as a particular value of a particular row - that was my intention.
i need all of the information from that row - but throughout my program i want to be specific at different times.
in essence... i was to learn how to say
just pick these 2 columns, or pick all three.
i just want to know how to add more than one column of information to a message box...?
i have been messing with it - and what looks right - does not work...
-
Sep 28th, 2004, 08:47 PM
#12
Thread Starter
Lively Member
-
Sep 28th, 2004, 08:51 PM
#13
Frenzied Member
Apologies, I did not mean any offense.
-
Sep 28th, 2004, 08:59 PM
#14
^ escapegirl
does the code given to you work?
it seems mike and I given you the exact code you want..
-
Sep 28th, 2004, 08:59 PM
#15
Thread Starter
Lively Member
i know hehehe
its okay, i know...
can you answer my question tho???
-
Sep 28th, 2004, 11:56 PM
#16
Re: i know hehehe
Originally posted by escapegirl
its okay, i know...
can you answer my question tho???
Yes, just concatenate the string in the Messagebox's show function:
VB Code:
messagebox.show("Card Found, The Details:" & dr(0).tostring & " The secret:" & dr(1).ToString) 'and so on
-
Oct 13th, 2004, 05:44 AM
#17
Thread Starter
Lively Member
Got it to work - Thanks
I got the code to work... It took a little manipulation, but thank god and you guys/gals it works...
Thanx
*** If you can't explain it simply, you don't understand it well enough *** 
-
Oct 13th, 2004, 05:47 AM
#18
Re: Got it to work - Thanks
Originally posted by escapegirl
thank god and you guys/gals
No need to thank me twice.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|