I'm don't even know where to start on this one. I have a form where
the user is allowed to add one row at a time to a table via
textboxes. Imagine an order with an undefined number of items to be
selected at will by the user. The form has an empty textbox built
onto it where the user can select the first item. Once they do so (in
the textbox_validat ing event), a button appears giving them the option
to add another item to the order. If the user clicks the button, the
button_click event creates a new textbox and places it just below the
first textbox. This new textbox is where they will enter the data for
item #2.
What I need to do is to add some programming to the newly-created
textbox so that it is ready for a potential third item, and so on
until the user is done entering items. Is there a way to add code to
the form as the user is interacting with the form?
Thanks,
Randy 8 1837
No and I would not see why, here a sample how to build dynamicly controls as
much as you want on a form. http://www.vb-tips.com/dbpages.aspx?...2-03abce36aa60
Cor
"Randy" <sp***********@ gmail.comschree f in bericht
news:11******** ************@a2 6g2000pre.googl egroups.com...
I'm don't even know where to start on this one. I have a form where
the user is allowed to add one row at a time to a table via
textboxes. Imagine an order with an undefined number of items to be
selected at will by the user. The form has an empty textbox built
onto it where the user can select the first item. Once they do so (in
the textbox_validat ing event), a button appears giving them the option
to add another item to the order. If the user clicks the button, the
button_click event creates a new textbox and places it just below the
first textbox. This new textbox is where they will enter the data for
item #2.
What I need to do is to add some programming to the newly-created
textbox so that it is ready for a potential third item, and so on
until the user is done entering items. Is there a way to add code to
the form as the user is interacting with the form?
Thanks,
Randy
Thanks, Cor. I'll give it a try.
One question on this code. How can I modify it so that it works on
the validating event of a textbox rather than the click event of a
button?
Dim newTB As New TextBox
With newTB
.Name = "tb" + intItemCnt + 1
.Size = New System.Drawing. Size(320, 20)
.Location = New Point(205, 147 + intItemCnt * 20)
End With
AddHandler newTB.Validatin g, AddressOf ValNewTB
Controls.Add(ne wTB)
intItemCnt += 1
End Sub
Private Sub ValNewTB(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show ("Clicked was " & DirectCast(send er,
Button).Tag.ToS tring)
End Sub
Thanks,
Randy
On Jun 5, 1:20 am, Randy <spam.eastl...@ gmail.comwrote:
One question on this code. How can I modify it so that it works on
the validating event of a textbox rather than the click event of a
button?
Dim newTB As New TextBox
With newTB
.Name = "tb" + intItemCnt + 1
.Size = New System.Drawing. Size(320, 20)
.Location = New Point(205, 147 + intItemCnt * 20)
End With
AddHandler newTB.Validatin g, AddressOf ValNewTB
Controls.Add(ne wTB)
intItemCnt += 1
End Sub
Private Sub ValNewTB(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show ("Clicked was " & DirectCast(send er,
Button).Tag.ToS tring)
End Sub
Thanks,
Randy
' Typed in message
Private Sub Textboxes_Valid ating(...) Handles TextBox1.Valida ting
If MessageBox.Show ("Do you want to add another textbox?", "Add
new Item?", MessageBoxButto ns.YesNo) = Windows.Forms.D ialogResult.Yes
Then
Dim tb as New TextBox
tb.Name = String.Format(" tb{0}", intItemCount + 1)
tb.Size = New Size(320, 20)
tb.Location = New Point(205, 145 + intItemCount * 20)
AddHandler tb.Validating, AddressOf Textboxes_Valid ating
Controls.Add(tb )
intItemCnt += 1
End If
End Sub
Thanks,
Seth Rowe
Sorry to be slow, but this is the first time that I have used event
handlers. The error message that I can't resolve is:
Method 'Private Sub ValNewTB(sender As Object, e As System.EventArg s)'
does not have the same signature as delegate 'Delegate Sub
CancelEventHand ler(sender As Object, e As
System.Componen tModel.CancelEv entArgs)'.
Can anybody help me resolve this?
Thanks.
Change declaration of e in ValNewTB to CancelEventArgs
"Randy" <sp***********@ gmail.comwrote in message
news:11******** **************@ q19g2000prn.goo glegroups.com.. .
Sorry to be slow, but this is the first time that I have used event
handlers. The error message that I can't resolve is:
Method 'Private Sub ValNewTB(sender As Object, e As System.EventArg s)'
does not have the same signature as delegate 'Delegate Sub
CancelEventHand ler(sender As Object, e As
System.Componen tModel.CancelEv entArgs)'.
Can anybody help me resolve this?
Thanks.
"Randy" <sp***********@ gmail.comwrote in message
news:11******** **************@ q19g2000prn.goo glegroups.com.. .
Sorry to be slow, but this is the first time that I have used event
handlers. The error message that I can't resolve is:
Method 'Private Sub ValNewTB(sender As Object, e As System.EventArg s)'
does not have the same signature as delegate 'Delegate Sub
CancelEventHand ler(sender As Object, e As
System.Componen tModel.CancelEv entArgs)'.
Can anybody help me resolve this?
Thanks.
change System.EventArg s to System.Componen tModel.CancelEv entArgs as
indicated in the message. The name of the routine is not inportant only
that the routine has the same parameters (signature) as required.
Lloyd Sheen
Thanks everybody. Problem solved.
Randy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Thomas |
last post by:
Hi,
I'm having a problem with the dynamically created inputfields in
Internet Explorer.
The situation is the following:
- I have a dynamically created table with a textbox in each Cell.
- It is possible to Add and Delete rows
- Some cells have special attributes (readonly and events)
Here's a snippet of the code:
|
by: blue |
last post by:
I have a drop-down list, a radio button list and a submit button. I'm
adding these controls to a table and I'm adding the table to a Placeholder.
I'm adding it to the Placeholder because I don't know exactly where the
table will be located on the page until runtime. Before the form control
table is added to the Placeholder, I'm adding a whole bunch of tables to the
Placeholder. This is a flowchart program and I have multiple action boxes...
|
by: Bas Groeneveld |
last post by:
I am developing an ASP.NET application part of which consists of a data
entry wizard defined by entries in a data table - ie the controls on each
page of the wizard are determined by definitions in the table.
I know that I can dynamically add controls (eg a textbox) to the page
controls collection of a web form in a server event which will then be
rendered onto the form, as in the following snippet:
System.Web.UI.WebControls.TextBox...
|
by: Paul |
last post by:
An early Happy Thanksgiving to you and yours...
We develop data driven apps. We dynamically place controls on a panel which
may be then be placed on a web form or another control. My problem is that I
can't get the events of the hosted controls to fire.
e.g.
' myUserControl.ascx. is placed on myWebForm.aspx in the Designer
' myUserControl.ascx has a Panel on it, Panel1
' From code in myUserControl.ascx I pass Panel1 ByRef to a class...
|
by: buran |
last post by:
Dear ASP.NET Programmers,
I have a HTML table (running as server control with the control ID:
tblInsertSP). The table has 16 rows with textboxes. Depending on the value
of the ddlSPType, which is a dropdownlist control on the page, I add
dynamically extra rows to the table. For instance, if the ddlSPType selected
item is Aviation Company, an extra row containing a cell with the textbox
control txtAircrafts is added to the HTML table...
| |
by: scsharma |
last post by:
Hi,
I am working on creating a webapplication and my design calls for creating
main webform which will have menu bar on left hand side and a IFrame which
will contain all the forms that are shown when menu items are clicked.Besides
these i would like to put a custom status bar. Any error message encountered
in any of the webpage will be displayed in the banner.
The problem iam encountering is how to access the customer status bar in
child...
|
by: Xero |
last post by:
When my program is launched, there is a textbox on the form.
When the user enters a character into the textbox (TextChanged), a second,
declared textbox is added using this block of code.
Dim textbox2 As New TextBox
Controls.Add(textbox2)
When the second textbox is filled with character as well, a third textbox is
added using smilar method as adding the second one. However, when I add the
|
by: Dave A |
last post by:
I have a problem that I have boiled down to a very simple example.
I have a user control that displays a some data from a business object. On one screen I have a collection of these business objects and wish to display the user control multiple times. On this web page I simply bind the repeater to the data source and in the ItemDataBound event dynamically load the user control via "LoadControl()".
The user control contains an auto post...
|
by: Craig Buchanan |
last post by:
I dynamically add data-bound templates to a gridview in my ascx control.
while this works correctly when the gridview is databound to the
datatable, i'm having issues on postback.
i would like to iterate thru the gridview's rows, examine the databound
controls, then perform a database action. for some reason, i can't find
the controls.
i have a two templates: one that uses a label the other uses a textbox
to display data. when the...
|
by: semomaniz |
last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have set text boxes and labels inside the table rows. I then added a button. All of these are done through code.
The problem that i am having is i can get the value from a text box with resides inside the first panel (out side of panel that is...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: 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...
| |