473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

increment 4 digit number automatically...its urgent

how to increment 4 digit number automatically in vb.net windows appln

for example:

dc0001-----this is first userid
next time i click new button the user id automatically increased to dc0002
likewise

anybody to help me
Mar 27 '07 #1
2 3263
sravi8
4
use padright for your numeric varaible and cocant with your alphabet variable

eg

Dim IntNumber as integer
Dim StrCode as String


'eg
'IntNumber = 1
'strcode = dc

intnumber = intnumber.Tostring.PadRight("0",4)
strcode = strcode & intnumber

i hope it will help you
Mar 27 '07 #2
prabunewindia
199 100+
how to increment 4 digit number automatically in vb.net windows appln

for example:

dc0001-----this is first userid
next time i click new button the user id automatically increased to dc0002
likewise

anybody to help me

Dim id As String = TextBox1.Text 'the last id no is in textbox1. you can get it
from database

Dim number As Integer = id.Substring(2, 4)
If (number < 9) Then
TextBox1.Text = id.Insert(5, (number + 1).ToString()).Remove(6)

ElseIf (number < 99) Then
TextBox1.Text = id.Insert(4, (number + 1).ToString()).Remove(6)
ElseIf (number < 999) Then
TextBox1.Text = id.Insert(3, (number + 1).ToString()).Remove(6)
ElseIf (number < 9999) Then
TextBox1.Text = id.Insert(2, (number + 1).ToString()).Remove(6)

End If

it will work untill the no goes dc9999
all the best
Mar 29 '07 #3

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

Similar topics

11
by: csomberg | last post by:
SQL 2000 I thought I would throw this out there for some feedback from others. I'd like to know if you feel using MS auto-increment field is a good solution these days or should one grow their...
13
by: puzzlecracker | last post by:
If you run this program, it will give very unexpected results. Can anyone explain the nature of this anamaly? (also what is the function call to execute 'pause'); #include<stdio.h> //void...
0
by: Anders W. Pedersen | last post by:
Hi there! I'm working on a medium-sized .NET web application written in c#. We are using Visual Studio 2003 for development and Visual Source Safe as our code repository. Occasionally, we do a...
5
by: vul | last post by:
In VB6 there is Auto Increment check box in Project Properties, which allow you have a new version every time you compile the project. Is there any easy way to have this feature in VB 2005? Some...
8
by: Candace | last post by:
I am using the following code to pick off each digit of a number, from right to left. The number I am working with is 84357. So for the first iteration it should return the number 7 and for the...
3
by: crazy123 | last post by:
Please guide me as how do can we create a aut generated number... I have created a database. I am giving each name in the database entry a unique ID I want the Unique ID to be auto generated...
0
by: vidhyapriya | last post by:
how to increment 4 digit number automatically in vb.net windows appln for example: dc0001-----this is first userid next time i click new button the user id automatically increased to dc0002...
3
by: nfrjob | last post by:
Hi there, I'm an advanced beginner, so please bear with me... I have a simple table that has four fields in it: Zone (which will store a three letter code such as ABC), Year (a four digit number...
5
by: David Wright | last post by:
Hello Everyone I would be grateful if someone could help me with the automatic increment of a field on my subform called ‘Test_SrNo’. I am Using Microsoft Office 2000. The auto entry of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.