By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.

automatically generate sr no in textbox

P: 4
hii
i am using vs 10 & access database 7.i develop a small application that store sr no and name.so i want to generate sr no automatically in textbox .
main thing is if there are total 5 sr no saved and suppose i delete sr no 3 then so it can be rearrange
i.e.
1
2
3
4
5
if i delete 3
then it will show
1
2
4
5
but i want to display it
1
2
3
4

i.e.rearrange it


please help me

thanks
Apr 15 '14 #1
Share this Question
Share on Google+
2 Replies


100+
P: 294
How are you getting "sr no" to the text box?
Apr 15 '14 #2

P: 4
hii
i am using the following code to get sr no in textbox




Expand|Select|Wrap|Line Numbers
  1.         Dim dr As OleDbDataReader
  2.         Dim a As Integer
  3.         If Not cn.State = ConnectionState.Open Then
  4.             cn.Open()
  5.         End If
  6.         sqlqry = "select srno from Records"
  7.         cmd = New OleDbCommand(sqlqry, cn)
  8.         dr = cmd.ExecuteReader
  9.         While dr.Read
  10.             a = dr(0)
  11.         End While
  12.  
  13.         Dim i As Integer
  14.  
  15.         If Integer.TryParse(CStr(CDbl(a) + 1), i) Then
  16.             TextBox1.Text = i.ToString
  17.         End If
Apr 16 '14 #3

Post your reply

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