Hey guys,

Im having a little problem with adding textbox.Im generating unique key with OrderNumber+ProductId+Series.

OrderNumber:18501
ProductId:2100
SeriesNumber:01

Series starts at "01" and gets added one everytime I hit button1,so next time I press button1,it will be "02".When I add them up this is the result I get:
Result:18501-2100-1

But I want the result to be like this:
Result:18501-2100-01

I want the series number to be a two digit value.How can I make this happen?Do I look

Recommended Answers

All 9 Replies

Try,

no=2
str=no.ToString("D2")

Try,

no=2
str=no.ToString("D2")

I dont understand.Sorry Im a newbie!!!

Try this:

dim SeriesNumber_in as string
dim SeriesNumber_out as int
dim mi as int

SeriesNumber_in="Put SeriesNumber Here"
mi=SeriesNumber_in.lenght

if mi = 1 then
SeriesNumber_out = 0 + mi
End If

SeriesNumber_out should give you the answer, for example if you input a 2 it will give you a a 02 but if you input something like a 12 it will stay un-touched.

plz reply if this helped or if you need further assistance. :)

commented: Worthless Garbage. -2

Try this:

dim SeriesNumber_in as string
dim SeriesNumber_out as int
dim mi as int

SeriesNumber_in="Put SeriesNumber Here"
mi=SeriesNumber_in.lenght

if mi = 1 then
SeriesNumber_out = 0 + mi
End If

SeriesNumber_out should give you the answer, for example if you input a 2 it will give you a a 02 but if you input something like a 12 it will stay un-touched.

plz reply if this helped or if you need further assistance. :)

It doesnt do anything...

Try this:

seriesnum = seriesnum * 100 
dim seriestr as string = right(seriesnum.tostring,2)

Try this:

seriesnum = seriesnum * 100 
dim seriestr as string = right(seriesnum.tostring,2)

Cant seem to get Right Function to work!Gives me this error:
Public ReadOnly Property Right() As Integer' has no parameters and its return type cannot be indexed.

Anyone have other methods?

You can try Microsoft.VisualBasic.Right or SubString

Got it figured out guy!!Thanx for the ideas

Used
If Len(Serie.ToString) = 1 Then
Serie = "0" + Serie
Else
Serie = Serie
End If

this did the work!!

Member Avatar for Unhnd_Exception

Glad you got it figured out. You did in 5 lines of code what adatapost did in 1 line. Congratulations!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.