Warning: The magic method ModuloBox::__wakeup() must have public visibility in /home/codewwdz/public_html/wp-content/plugins/modulobox/modulobox.php on line 52

Warning: The magic method ModuloBox_Base::__wakeup() must have public visibility in /home/codewwdz/public_html/wp-content/plugins/modulobox/includes/base.class.php on line 37

Warning: The magic method ModuloBox_Normalize_Settings::__wakeup() must have public visibility in /home/codewwdz/public_html/wp-content/plugins/modulobox/includes/normalize-settings.class.php on line 143

Warning: The magic method ModuloBox_Gallery::__wakeup() must have public visibility in /home/codewwdz/public_html/wp-content/plugins/modulobox/public/gallery.class.php on line 61

Warning: Cannot modify header information - headers already sent by (output started at /home/codewwdz/public_html/wp-content/plugins/modulobox/modulobox.php:52) in /home/codewwdz/public_html/wp-content/themes/hestia-pro/functions.php on line 7
Auto Increment Slno. Code in VB .Net 2013 - Coders Helpline
Example : How to Auto Increment the Serial number value in a text box.
NB: Put database connectivity code here first and write the code either at form load event or other proper event.

Sub Autoincrement()
   Dim x As String = ""
   Dim p1,p2 As Integer
   p1 = 0
   cn.Open()
   cm.CommandText = "select slno from sale"
   rdr = cm.ExecuteReader()
      While (rdr.Read())
         x = rdr("slno").ToString
         p2 = Val(x)    'Val() convert String into Integer.
         If p2 > p1 Then
            p1 = p2
         End If
      End While
   cn.Close()

   Textbox1.Text = p1 + 1
End Sub

NB : Call and Use Autoincrement() Subroutine at proper places as per need in the program.

Loading

Categories: VB .Net Codes

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.