Hello,
I am designing a program using Visual Basic 2005 Express Edition that will ask the user for a number between 1 and 50.
When the button on the form is clicked, another form (Form2) opens and the number is passed to Form2.
If the user inputs "20" in the first form, I need 20 textboxes to appear in a column in Form2.
If the user inputs 10, I need 10 textboxes and so on....
What I need help with is coding for the correct number of textboxes in Form2.
Any and all help will be appreciated.
Thanks.
4 1463
Hello,
I am designing a program using Visual Basic 2005 Express Edition that will ask the user for a number between 1 and 50.
When the button on the form is clicked, another form (Form2) opens and the number is passed to Form2.
If the user inputs "20" in the first form, I need 20 textboxes to appear in a column in Form2.
If the user inputs 10, I need 10 textboxes and so on....
What I need help with is coding for the correct number of textboxes in Form2.
Any and all help will be appreciated.
Thanks.
Hi. With the version of vb that you are using there is a problem with this approach. vb.NET does not support control arrays and a control array is exactly what you need for your project. Otherwise the coding will be cumbersome and bulky.
Do a google search for vb.NET control array
good luck
...vb.NET does not support control arrays and a control array is exactly what you need ...
Damn! MS were really keen to get rid of control arrays, huh. I wonder why, when they are so amazingly useful.
I actually found some MS(i think) example code called "Controlarraysa truntime"
and since iam new to programming i dont really understand everything here. -
Dim MynewPos As New Point(50, 40)
-
-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
Dim pnt As New Point(CType(TextBox2.Text, Integer), CType(TextBox3.Text, Integer))
-
-
CreateThem(CType(TextBox1.Text, Integer), pnt)
-
End Sub
-
-
Public Sub CreateThem(ByVal NumbOfPix As Integer, ByRef mypt As Point)
-
MynewPos = mypt
-
-
Dim i As Integer
-
If NumbOfPix = 0 Then
-
Exit Sub
-
End If
-
-
For i = 0 To NumbOfPix - 1
-
Dim PIC As New System.Windows.Forms.PictureBox
-
PIC.Size = New System.Drawing.Size(20, 20)
-
PIC.Location = MynewPos
-
PIC.Name = "PictureBox"
-
PIC.BackColor = System.Drawing.Color.Black
-
PIC.Text = i
-
PIC.ForeColor = Color.Black
-
MynewPos.Y += 30
-
Me.Controls.Add(PIC)
-
Next
-
End Sub
-
End Class
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I debug
it in PHP designer, it works with no problems, I get the test email. If
|
by: Jason |
last post by:
Hi,
I was wondering if any could point me to an example or give me ideas on how
to dynamically create a form based on a database table? So, I would have a
table designed to tell my application to create certain textboxes, labels,
and combo boxes? Any ideas would be appreciated.
Thanks
|
by: rp |
last post by:
Hi,
How would I create runtime tabpages with runtime
controls(textBoxes,comboBox, checkedListBox), inserting,deleting, and
modifing the tabpages whenever I want to in C#? Thanks in advance.
rp
|
by: Newbie |
last post by:
hi!
i am able to upload files successfully. but i have one minor problem. files
are uploaded correctly if the directory exists, it is throwing an exception
if the directory doesnt exist. but the directory name is created during
runtime. is there a way to create a directory during runtime?
exception:
Error saving file C:\temp\188\
System.IO.DirectoryNotFoundException: Could not find a part of the path
|
by: Anand Sagar |
last post by:
I have a Panel1 and button1 on my webform. At runtime, I create 2 textboxes.
I do it at the Page_Load event. I put the code within the " If Not
isPostBack"
For the button click event, I will do a post-to-database coding and then
show the same page again. I put EnableViewState = True for the textboxes.
In the Page_Load if I dont use the IsPostBack checking, the code works fine.
The button shows that the code has been fired and the page...
| |
by: Praveen |
last post by:
I have script files embedded as resources in my dll. During runtime, I would
like to write it out into the app dir (or a app sub-dir) and send the
appropriate virtual path to the client. This makes deploying my dll much
easier - just a single dll, not having to worry about deploying script
files.
However, the runtime doesn't seem have enough permissions to write out to
the app dir (or any of it's subdir), by default. The folder where I...
|
by: Kum |
last post by:
Hi,
I need help in asp.net dynamic textbox controls
validation.
I am creating textbox controls dynamically on a
asp.net webpage. Now after creating the textboxes on
the page I want to validate these text boxes when the
user submits or posts back to the server. My intention
was to create a textboxvalidator function which takes
the control name as argument and returns an true if
|
by: David S. Zuza |
last post by:
Hey,
I am new to .NET and I would like to index a button control on my form
just like I used to be able to in VB6. In VB6 all I had to do was create one
control and new to something like
cmdButton()
and then I could copy it in the design window and refer to anyone of the
buttons by refencing its index like
|
by: Mats Lycken |
last post by:
Hi,
I'm creating a CMS that I would like to be plug-in based with different
plugins handling different kinds of content.
What I really want is to be able to load/unload plugins on the fly
without restarting the application.
What I did was to create an AppDomain that loaded the plugins and
everything was great, until I tried to pass something else that strings
between the domains...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |