473,396 Members | 1,783 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.

Auto generate numbers in vb.net form

I have created a vb.net form and wish to auto generate number within a textbox each time i click a button. Can you be of any to me?
Nov 23 '20 #1
1 5014
SioSio
272 256MB
Is the number a sequence or is it random?
If you want to set the sequence number in the text box, use the Button2Click code, and if you want to set the random number in the text box, use the Button1Click code.
Expand|Select|Wrap|Line Numbers
  1. Dim seq_num As Integer = 0
  2.     Sub Button1Click(sender As Object, e As EventArgs)
  3.         Dim rnd = New System.Random        ' Create an instance
  4.         Dim intResult = rnd.Next(1, 1000)  ' Get random numbers from 1 to 1000
  5.         textBox1.Text = intResult.ToString
  6.     End Sub
  7.  
  8.     Sub Button2Click(sender As Object, e As EventArgs)
  9.         seq_num = seq_num + 1
  10.         textBox1.Text = seq_num.ToString
  11.     End Sub
  12.  
Nov 24 '20 #2

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

Similar topics

6
by: Sebastien | last post by:
Hi, I am building a products database, linking sales and production. Each part has a unique sales Stock Code and Production Number. The sales stock code is a combination of letters and numbers...
2
by: SalimShahzad | last post by:
Dear Gurus, i had written following codes to auto generate the next claim no Private Const strC = "GCT/02/J/" Private Sub Command1_Click() Dim stra, stre As String Dim intb, intd As Integer...
1
by: popsovy | last post by:
I am new to the discussion groups and to the .NET world, so this is probably a very basic question.. Is there any quick way in .NET to auto-generate data forms from typed datasets or SQL queries?...
1
by: firenet | last post by:
21 function js_reply_msg(node,g_id,u_id,par_id) 22 { 23 node.innerHTML="<FORM><TEXTAREA name=\"msg_con\"><\/TEXTAREA><br><INPUT type=\"submit\" value=\"reply\"><\/FORM>" 24 ...
0
mmarif4u
by: mmarif4u | last post by:
Hi guys,,, I have simple problem, Problem is that, i want that a php variable create date with numbers, look like this: $rtno = date("md,here some numbers but auto increment start from 001...
1
by: ganesh22 | last post by:
hi... I am doing a project asp.net with C#.my requirement I want to do auto generate password for my application that means when user forget his password when he clicks a link it will auto...
2
by: ganesh22 | last post by:
Hi, My requirement is i want to auto generate ID'S in sqlserver that means in database one column is there recordid for that coloumn i want to add numbers with no duplication like JDS 10001,JDS...
7
by: blindaviator | last post by:
I am trying to setup a webpage in PHP to auto generate a table filled with text boxes for a form submission.. Is this possible to do in PHP?? Basically what I need to do is have a main page...
0
by: ivyG | last post by:
How do you auto generate the name of the user who is logged in? For example, I had a Detail View to allow the user to insert the data, and i have a column named "Teacher In Charge 1". I wish...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.