Forms :: Control Other Form From A Main Form?
Sep 3, 2009How to control other form from a main form? For example :
I want to change background color in Form2 after a button in Form1 is clicked.
How to control other form from a main form? For example :
I want to change background color in Form2 after a button in Form1 is clicked.
I am looking for a way to be able to use the tab control on my main form and transfer all 3 other forms onto that main form that has the tab control. Problem being is that some functions are named the same in each of the septate forms i want to bring into just one for the tab control.Is there a way to separate the code for each form ON the main form of the tab control so i don't have to rename/recode each of the 3 forms i want to place on the main form of the tab control? [code]so when i put both form1 and form2 code on the main form where the tab control is, its going to tell me that i have a duplicate function name.
View 2 RepliesWhat I have is a user control that has two RichTextBoxes. In the user control, there is RichTextBox1's TextChanged event, I want it to set RichTextBox2's Text to the same as RichTextBox1's Text, I'm currently using: RichTextBox2.Text = RichTextBox1.Text. The user control is on the main form, when I run the application and type I get this error: StackOverflowExecption was unhandled. [Code]
View 4 Replies[Code] I want like to check if a file exist on main form, if not: force open settings form. And then when the user is closing the form with exit button = check if the file exist again. If it doesn't exist, close application. It's a huge application and I need optimized on most parts. Also, the settings form is asking the closing question two times.
View 1 RepliesIn the main form the user can choose to download information from a device.Since this request takes time, when "download information" is pressed I open new form in a separate thread: Private Sub RunDownload()
[Code]...
When I open my child form,
frm_Analogs.ShowDialog()
It opens up the new form, but now I can not interact with my main form. It will not accept focus or allow me to interact with it.
Do I need to change the form type?
I have to write an application that consists of mainly one main form, but several different things I wanna display. Pretty standard I guess. So there is a menu, some controls, and the main stuff below (ranging form graphs, tables, dropdown boxes, print preview, etc). I would like to use it like one would use frames in html, design an object that is limited to a box or panel that I define. The literature I have does not give me a clear idea of how to do this (yet). The most obvious seem to be the use of MDI, open a predefined form with no borders, maximize it before showing and remove all minimize/maximize options. But that does not work so well. The form inside the MDI parent does not fit the size that is given for it when it is loaded. e.g.
[CODE]:......................
So my main question is: Is MDI the way to go here at all or are there better/easyer ways to achieve this? If MDI is the way to go, how do I sucessfully restrict a child form inside another object, without giving the user any opportunity to resize (i noticed that I have minnimize/maximize/close buttons, even if I disable them on the child forms themselves)
The code is listed below which hopefully illustrates what I'm trying to do:[code]....
View 12 RepliesI've got a Panel on a main Form containing a PictureBox control on Top of a TableLayout control. Both the child controls have their docking properties set to Top. The Picture control has sizemode set to Zoom.
What I'm finding is that the picture doesn't size properly when I start the app. There is a border at the top and bottom in the PictureBox control. It's only when I resize the overall form that it's correct.
So at the moment I've got this ugly bit of startup code, just to fix the problem Me.WindowState = FormWindowState.Normal Me.WindowState = FormWindowState.Maximized
What am I missing?
I've created a windows form application in vb 2010. I've got all my forms complete and now want to add a Login screen. One the login screen, after the username/password is entered and OK is pressed, I try to open the a connection string. Obviously if the connection fails, the user has entered the incorrect credentials. If the credentials are ok, True is returned and I then open up the Main form that shows the correct items for the logged in user.
[Code]...
I need to get a subtotal from multiple forms and add them together on the main form. I can add two forms together but not the third.
View 1 RepliesI was a vb6 user, done a few projects only with forums Now i am moving to vb.net(vb2010) and i have some trouble.Lets say we have a form(form1), a module(mod1) and a textbox on the form1.
i want to start a Sub (DoWork) in the module but in a new thread.
Dim Thread1 As System.Threading.Thread
Thread1 = New Threading.Thread(AddressOf mod1.DoWork)
Thread1.Start()
The DoWork sub does some stuff and when it's finished i want to change the text of a textbox1 in the main form and start another sub (DoWork2) on the main form under the main thread not the one DoWork is running under.
Plese do not refer me to another post that mighe give me a part answer, try to explain to me what i have to do and why.
I am using the following code in the 'Application.Designer.vb' to set one of the two forms as the the mainform for my splash screen.The global string array gSetupStr(0,1) only produces a correct result when any Msgbox is inserted before the 'If' statement.However,I do not want the Msgbox during a splash screen, but do want to control the mainform. [code]
View 1 Repliesi have my main child form open. then i show the new form:
[Code]...
but when the form opens it flickers a lot. so i want move the new form behind the main form while it loads so the user does not see the flicker. once it is done loading i will set the form to topmost. how do i move the new form behind the main form?
I wanted to let the users to select their desired wallpapers dynamically in the window main form. Is it possible? Funtional spec:
1. Let the users to select their desired wallpapers from any directory.
2. Save the wallpaper in the database.
3. Load the wallpaper in the main form after login sucessful.
I have a splash screen, the default from Visual studio. It loads up, is shown for a few seconds, then, when it disappears, the main form is loaded. Now here is the problem: the main form appears in the back, behind the windows explorer window I load the application from.
The weird thing is that this only happens on some computers, particularly Windows XP machines.I tried a lot of things like BringToFront() or TopMost = true in the on Load event of the form but nothing seems to change this.
Am devloping an application with multiple forms, which reside on top of a main form. i.e the main application window. The 'child' forms do not need to be linked in any way as they do not pass information to the parent form, as all the parent form does is act as main window.Now I would like to know what is the correct way for the 'main window' form acting as a container for the other forms? So that all the smaller secondary forms stay focused on top of the main application form, that when the main window is minimized, so these forms should do also etc..
I have read other posts and they mention, leaving all the forms standard i.e. IsMdiContainer = False and then using form.showDialog() to call the secondary forms. This did not work for me as what happens is that as soon as I give focus to the main app form, the secondary form disappears underneath.I tired making the main app form IsMdiContainer = True and when it loads calling:
frmMemberForm.MdiParent = Me
Now this works, because I can click off the form and minimize the app etc and the frmMemberForm doesn't disappear. However if i close the MemberForm and reopen it, it looses this property and once again when it looses focus, it will disappear.
I have a main form and a user control form. The user control form is on the main form. How can I send data from user control label1 to main form label 1?
View 3 RepliesWhat I'd like to do is in my application move a control like a groupbox or frame with content on it from e.g the main form to a tabpage on that same main form using code.
I can change the position of the control using it's location, but I haven't got a clue on how to move it from the main form to a tabpage, or from 1 tabpage to another.
-Is this at all possible and if so, how can it be achieved?
I build my project and i got some problems. First i want to print barcode for books(toolstripmenu item). but i cant. here's the code that i found:
[code..]
second problem is printing again. i want to print my MS ACCESS .mdb from child datagridview's records.
third one i want to save and load(with dialogs) my database from main form to child forms' datagridview.and the last one is help provider. i prepare my own .htm help file, when press F1 it opens. but i dont know how to call provider to toolstripmenuitem and help provider keep my computer's path so when i call provider another computer, the programme cant find the path.
I have a windows application with a main form, on which a user control is added dynamically when a device connects trough USB.
On a user control, there is a thread wich is getting data from the device trough USB and when it is finished, I want to change a progressbar that is located on the main windows form where user control reside.
This is the code that is I call on the user control thread to change the progress bar value:
Frm_Main.UpdateProgressBar(CInt((AllBytesReceived / MaxBytesInFlash) * 100))
and this is a code that is called on the main form:
Private Delegate Sub UpdateProgressBarDelegate(ByVal value As Integer)
[Code]....
I have a tool window that I want to stay above the main application form, but not stay on top of all windows forms. Similar to the floating properties window for visual studio - it always stays on top of the main VS window, but if I select another program, like internet explorer, the floating properties window will be behind internet explorer.
What I have is an application that has several forms that may be displayed at the same time. I have a Messages form that displays messages generated by the code in the form, that gives the status of the application. Obviously, the user would not normally be working on this form, but they may want it to be visible to see the status messages from the program (File saved confirmations, etc). So, my two options right now are I can set the form to be on top of all other windows forms or, when the user clicks on the main application form, the messages form would be hidden by the main form.
I need to quickly demonstrate a project and decided to create a user control that is connected to an Access database through pure simple data connections (create the dataset and drag it on the control.)When I build the project and add the usercontrol to panel control on the main form, no data is shown in the datagrid.When I add the data components directly on the main form, the data is displayed properly. why I can't get my databound user control to display the data on my main form?
View 2 RepliesI have a main form with datagridview containing a list of contacts:
VB
Public Class Form1
Private Db As New DataClasses1DataContext
Private Sub Form1_Load
[Code]....
After saving, I get the correct message ("Saved"), and the DataGridView in the first form gets updated in real time.
But... when I take look at the data (or close and reopen the forms) the data in the database (SQL server) have not changed! What happens!
How do i load the Main form of a WPF so that a seperate thread goes and gets data from the database while the form is in an apartmentstate? (drag-able / movable) I Know this is possible with opening a new window from your main form like this :
Private Sub openOrderWindow()
Dim OrderWindow As Orders = New Orders
OrderWindow.ShowDialog()
End Sub
[code]....
I've tried putting MyBase.ShowDialog() and .Show() and .9000+ other things The only benefit I've got out of using a seperate thread to load from the databse is i can see the screen right away (as oppose to it being a transparent box until it loads) but i cannot move it around or minimize it?is there any way to make it Movable while it loads?
How can I make the main form grey out/translucent black when a new form opens on top?
View 8 Repliesi am having some trouble in my Windows form application. i have 2 forms1st Main / Parent Form2nd Sub / Child Form (Menu)
View 7 RepliesI'm having an interesting issue that I can't reproduce on a different project, but can consistently on this one. I have no clue what might be causing it, but am hoping that someone may have seen it before.
I have a main form, from which I run a series of checks. On this form, I have a listview control. Because of some issues with the refreshing of this listview control, I had to create my own messagebox. It's just a form that displays some text ( it also happens to look nicer than MsgBox; in my opinion, anyways ). It's been working great for months, until recently.
My problem is that on my main form's load event, I run this check, which returns an error within a try/catch block. I then call my custom messagebox with a message. It in turns calls it's ShowDialog() function.
In any other situation ( after the main form has been loaded ), I have no problems. The messagebox goes on the screen and behaves appropriately ( ie: waits for my input and acts as a modal dialog ( stops execution of my main form's thread ) ). However, on this onload event, my messagebox comes up and goes away almost immediately afterwards.
I've traced it all the way to the showdialog() call. For no explicable reason, it appears to skip right over this call, without me doing anything on the form.
Here's what the inner trace looks like ( when I put a breakpoint on the onclosing event for this messagebox form ):
CODE:
I have a program I've been working on for some time now and I'd like to try to streamline it somewhat. I have a main menu form that has a split panel, in the left panel is a treeview that displays forms you can open and when one is selected, it opens in a child window in the right panel. Each time I open form I called DWNForm, it does a series of dataset loads which are the populating items for a series of listviews.
What I would like to do is have these datasets load once during the mainMenu load and then have the DWNForm be able to access the datasets once it is called from the treeview selection.
I want to create an IMAGELIST in a main form and add to it then have it accessible within a child form. I found several MS examples on database shared access but this is NOT the concept I am after. Straight forward:
Child_Form.<function_to_execute_in_child_form>(The_Passed_Imagelist)
So, within the child form it want to do whatever I like to the IMAGELIST! I have tried passing the object by reference and anything I could think of.