2 Replies - 971 Views - Last Post: 13 December 2008 - 07:42 AM Rate Topic: -----

#1 vks.gautam1   User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 325
  • Joined: 21-March 08

vb.net code help

Post icon  Posted 04 December 2008 - 05:30 AM

In this code i stored data in database. When i save data (Emp-001) It will show in textbox (EMP-002) AUTOMATICALLY.

Wt is understand is that TRYPARSE CONVERT string to integer. that result is saved in variable "TheNumber".
Trim Remove spaces. & Split function seprate (Emp-) from (001).

but wt is meaning of code whick is in Red colored

Dim TheNumber As Integer
If Integer.TryParse(Textbox.Text.Trim.Split("-")(1I), TheNumber) = True Then
'The Number parsed correctly
TextBox.Text = Textbox.Text.Trim.Split("-")(0I) & " " & CStr(TheNumber + 1I)
End If

Sorry i mistakely post this code in vb forum instead of vb.net

This post has been edited by vks.gautam1: 04 December 2008 - 07:33 AM


Is This A Good Question/Topic? 0
  • +

Replies To: vb.net code help

#2 Jayman   User is offline

  • Student of Life
  • member icon

Reputation: 423
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: vb.net code help

Posted 04 December 2008 - 10:42 AM

Moved to VB.NET.
Was This Post Helpful? 0
  • +
  • -

#3 wagast   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-December 08

Re: vb.net code help

Posted 13 December 2008 - 07:42 AM

try to help
when you save data (EMP-001) automatically shown (EMP-002) because data it sore was EMP-001 so the dataset in bindingcontext is counting + 1, way ? because the dataset is read a column in database and counting it. for example

dim query as string

query = "select * from employee where id like '"  & txtEMPId.text & "%'"
dataadapter1=new oledbdataadapter(query,con)
dim n as integer
n=me.bindingcontext(dataset1,"emp")).count
txtEMPId.text = "EMP-" & checkDigit(n+1)




and the result in txtEMPId.text is EMP-002 after counting from database

Note : the checkDigit is a procedure that you must work it first

regards from Indonesia

This post has been edited by wagast: 13 December 2008 - 07:43 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1