|
-
Aug 21st, 2003, 01:08 PM
#1
Thread Starter
Frenzied Member
adding items in comboBox
I'm adding credit card numbers in a comboBox. I need to mask the first 12 digits with X's:
XXXX-XXXX-XXXX-1212
not sure how...here's my do while loop to fill in the dropdown.
Do While objDR.Read = True
cardNo =(objDR("credit_card_no"))
Me.cmbCard.Items.Add(cardNo.ToString("XXXX-XXXX-XXXX-####")
Loop
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Aug 21st, 2003, 02:39 PM
#2
-
Aug 22nd, 2003, 07:47 AM
#3
Thread Starter
Frenzied Member
it's not working
I've also tried this, but it's giving me an error under the RIGHT function...
VB Code:
objCon.Open()
objDR = objCom.ExecuteReader
Do While objDR.Read = True
cardNo = (objDR("credit_card_no"))
Me.cmbCard.Items.Add("XXXX-XXXX-XXXX-" & (Right(cardNo, 4)))
Loop
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Aug 22nd, 2003, 09:30 AM
#4
Fanatic Member
is objDR("credit_card_no") a number or string?
-
Aug 22nd, 2003, 10:12 AM
#5
Thread Starter
Frenzied Member
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Aug 22nd, 2003, 10:22 AM
#6
Ahh ToString or Format doesn't really format strings into other strings just non-strings into strings.
The second method should work, here:
VB Code:
objCon.Open()
objDR = objCom.ExecuteReader
Do While objDR.Read
cardNo = (objDR("credit_card_no"))
Me.cmbCard.Items.Add("XXXX-XXXX-XXXX-" & cardno.Substring(cardno.Length - 4, 4))
Loop
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
|