-
Need to set controls inside UserControl from another window
I have this user control that I have programmaticaly added to my main form. My control also inherits from a base user control. This base user control contains date and time textboxes with buttons to enable manually setting the date and time. One button formats the system time and date and displays them in the appropriate textboxes. The code for this is contained in the control.
Now for my problem. I need to be able to launch another form which contains controls which allow me to increment or decrement the hour or minutes in my usercontrol. (It also contains a Callendar control) I am unable to access the textbox controls inside the usercontrol to set the value of each textbox. I've tried Public Property but it does not show up when I call either the baseUsercontrol or the target user controlfrom my form. It's the user control which launches the "Updating Form".
I've looked on the NET for ideas but what I found was written in C#. My code is VB.net. I know enough about c# to understand the jist of the code but not enough to be able to convert the code to vb.
What I found and thought had possabilities was raising my own events. Great idea, but how can my main form know about the event until after the app is compiled and running? Remember, the control is added by code. I tried pasting the code I found into my control (modified to what I thought would make it work in my app) and wrote an event procedure in the MainForm as a test. It didn't work.
It's late at night and I'm tired and frustrated so please, if I'm rambling and my explanation isn't clear, ask me some questions. I need help.
Thanks
-
Thanks to those who viewed my question.
I solved the problem myself. I was looking to close to the active code.
I launch the form Calender as a modal form. All I had to do was add the code to update the user control_1 after my call to ShowDialog.
e.g. (DateTime1 is my user control_1)
Dim retVal As MsgBoxResult
With frmSetDateTime
.DateInput = txtDate.Text
.TimeInput = txtTime.Text
.ShowDialog()
txtDate.Text = frmSetDateTime.DateTime1.txtDate.Text
txtTime.Text = frmSetDateTime.DateTime1.txtTime.Text
End With
MyBad;-(
Similar Threads
-
By niranjana in forum AJAX
Replies: 0
Last Post: 07-30-2008, 06:25 AM
-
By cmartinez in forum VB Classic
Replies: 0
Last Post: 04-14-2001, 06:52 PM
-
By Miha Markic in forum VB Classic
Replies: 0
Last Post: 04-02-2001, 09:02 AM
-
By Alex Kennedy in forum VB Classic
Replies: 2
Last Post: 06-08-2000, 01:43 PM
-
By Alex Kennedy in forum VB Classic
Replies: 0
Last Post: 06-08-2000, 01:20 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks