Open Only One Instance Of An MDI Form
Apr 26, 2004I am using the following code to open an MDI form from a parent form...
[Code]...
I am using the following code to open an MDI form from a parent form...
[Code]...
Form does not open correctly on second instance
View 4 RepliesI have a question that I hope to find a much more simpler solution to.I have two forms in my program which are named Main and Second. The Second form has several textboxs, buttons (some disabled) and comboboxes. When the Second form is opened via the Main form on the very first instance, everything works fine.
However, if I re-open the Second form after previously closing it, the disabled buttons are no longer disabled and the text controls and comboboxes show the previous values entered from the first instance which I do not want. How can I ensure that the Second form will be opened "clean" every time.
Currently I have to add instances to the onload event to do this to ensure that the form is cleared on the second instance.textbox1.text = ""textbox2.text = ""textbox3.text = ""button1.enabled = False
creating single instance form in MDI Application. How to check whether form's instance created or not?
View 6 RepliesI want to open up an existing instance if my program is already running only if its running the same version.I noticed that this question was asked for only if the name exists, but what if the version is older, I just want to notify the user that an older version is still running, "please remove older version before starting this version."The other link is this one:Return to an already open application when a user tries to open a new instance but they don't talk about closing an instance if an older or newer version is detected.
View 3 RepliesI want to open up an existing instance if my program is already running only if its running the same version. I noticed that this question was asked for only the the name exists, but what if the version is older, I just want to notify the user that an older version is still running, please remove older version before starting this version. The other link is this one: Return to an already open application when a user tries to open a new instance but they don't talk about closing an instance if an older or newer version is detected.
View 1 RepliesI used to take the word count of many document by using the microsoft com component But the problem is used to open a document and and take wordcount and close it .This process take long time as i have to open a winword and kill the winword for a document .Can any one fine tune my code so that it would make the process much more faster than mine
Public Class WordCount
Dim appWord As Word.Application = New Word.Application
Dim aDoc As Word.Document
[Code].....
Actually i am a PHP/Mysql developer.i am newbie to vb.net and i am trying to develop a application which asks for a password when the user tries to open any.exe file
for example:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[code].....
I'm having a hard time getting this code to work, here's the code, I'm trying to open an instance of explorer.exe in a vb.net panel. Imports System.Runtime.InteropServices
[Code]...
I have a program that runs some data manipulation on a file when it is double-clicked and then displays this to the user.However, when I double click on the same file type of a different file it opens in a separate instance of my program instead of the same instance already running, i.e. some message that says would you like to reload file, YesNo, and then given the answer perform the action required.I have found some code to stop a second instance from opening, but this is inconvienient for the user to close out of the program everytime they want to view a new file.[code]
View 6 RepliesHow I Can open the same form in my application one time only can not open the form tow time in same time
View 5 RepliesI need to open a new instance of IE and direct it to a web page when a user takes a specific action.Used are random so setting anything on their machine is not an option.This works great on my local machine in developent but when deployed to my server it fails with no error.I must be missing a permission or something simple understanding that on the server things are run under the ASPNET account.My code is in a code class, myCode.We are in VS 2008 and IIS 6.Tried a couple of different things, they all fail silently.
Imports System.Diagnostics
Imports System.ComponentModel
Dim sWebPath as Sting = "https://mySecure.com/Page.htm"[code].....
I have been making a webbrowser for a while now, everything works well, except i am unable to make the 'open in a new window' button work right. So far i have managed to get a new instance of my form to open with the right url, but i am unable to keep that new form open when the orginal parent form closes.
Code:
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
e.Cancel = True
Dim Href As String
[code]....
I'm trying to figure out the best way to reference a control on a form from within a module. Unfortunately the form is just an instance, so it's not as easy as calling form.control...
Dim ChildForm As New frmSearch
' Make it a child of this MDI form before showing it. '
ChildForm.MdiParent = Me
ChildForm.Show()
That form has an option for printing, which calls another form where certain options are chosen. The print form in turn calls a function in a module, which tries to reference back to the origional form.
childform as new frmSearch -> frmPrintForm -> sub okToPrint (in module Print)
okToPrint tries to reference a listview on frmSearch, but can't find it.
For Each itmX In frmSearch.lstResults.Items
So the solutions I can think of off the top of my head are:
1. Somehow divine which form is the caller of frmPrintForm
2. Pass ChildForm to the frmPrintForm as a variable to be passed on to module Print..
3. Use frmSearch directly instead of using an instance of it.
Number 1 would be my preference, as I don't want to have to pass forms around like that.
I'm try on Ultimate version and Express version. Reinstall many time from web install and offline install. What should I do ?
View 10 Repliesget a button on form A to open form B and then close (not hide) form A when clicked?Background: I am coding a VSTO application for Excel in VB2008.
Private Sub FormAButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles FormAButton.Click
Dim FormB As New FormB
[code]....
I have an application the contains several excel files bundled with it. I'm not opening the files and processing them within my application. These files contain a data-connection to reload all of the pivot-tables within each excel file. I have a 'link' on my form, that when clicked, it determines which file to open and calls a sub using filename and executing Process.Start(filename) for any excel file I want to open. I have no problems opening any one of the files and then exiting excel.
The problem is when I 'close' a file, but don't exit Excel; then try to open another file(clicking link on form)... it creates a new instance of Excel.
I know from experimenting that the fileopendialog form will 'reuse' an existing Excel instance, IF it does not already have a file open.
How can I do the same thing without using the fileopendialog?
I don't want the end-user to have access to the folders where these files live. That's why I have multiple 'links' on my form, one for each xls that already exists. I just want them to be able to click on a link and the xls file opens AND if they choose to merely 'close' a file and not exit... Don't create a new instance of Excel, but re-use the existing one.
I have so many form in different module in one solution. I already instantiate a new Form as a global variables in my parent form. Then, call the code
frm.show()
in my button1 event
I have program requirement, I need to call an existing form to an MDI form by using a new form button and when I click it of course it will show my existing form, but I want is to create a new instance of the existing form, which make the the other forms different from one another inheriting the controls of the form I called. What I mean is I can create many child forms inheriting the controls of the existing form I called.
Dim newform as new System.windows.form
'this the function will call when on click the new form
Public Function newform()
[Code].....
I have a form with a button. I want the button to show a new instance of the same form but I don't know what to do. I'm working in vb.net 2010
View 3 Repliesthere is The (Name) property, which represents the name of the Form class.This property is used within the namespace to uniquely identify the class that the Form is an instance of and, in the case of Visual Basic, is used to access the default instance of the form.
Now where this Default Instance come from, why can't C# have a equivalent method to this.Also for example to show a form in C# we do something like this:
//Only method
Form1 frm = new Form1();
frm.Show();
But in VB.Net we have both ways to do it:
//'First common method (used slash because editor wouldn't format it properly)
Form1.Show();
//'Second method
Dim frm as New Form1();
frm.Show();
1) My question comes from this first method. What is this Form1, is it an instance of Form1 or the Form1 class itself. Now as i mentioned above the Form name is the Default instance in VB.Net. But we also know that Form1 is a class defined in Designer so how can the names be same for both the Instance and class name. If Form1 is Class then there is no (StaticShared) method named Show().So where does this method come from.
2) What difference they have in the generated IL
3) And finally why C# can't have an equivalent of this.
I have windows application and a form. If I open a form named "DetailForm" from main form named "Main1" by clicking the button, it should open only once. The problem I am having is, it is opening many instance of the form every time you click the button.
View 8 RepliesI then have an iteration (For Each loop) which lists all of the OUs on our site (set by the filter property). The issue here is within my treeview it lists everything without mimicing the AD structure we have.When searching on this it seems i have to change the search path to be one below the current OU and add it to my child node. I believe the search path is held in my RootDSE??, but when i look for the distinguishedName and try to pass that in i receive an
View 1 Repliesthis might be a really dumb question, but if someone could enlighten me I'm writing a Winforms application in VS2008 vb.net.The application starts with a main form. I've got a status bar at the bottom of the main form, indicating the application status. I've got a 'SetAppStatus' method on the Main form.
I'm writing a class that needs to update this status. So in the class I'm Importing the Main Form. But I don't know how to call this SetAppStatus method because I don't know what the instance of the main form is called Plus am I doing this the right way? I'm still grappling a bit with how .NET all fits together and it can get a bit baffling :)
I am currently trying to reference a new form that has been created, but I am unsure how I reference a particular instance of the form.
The form that has been created can have up to 4 different instances. Each one is created from the menu. The code that is executed is identical, with a parameter passed 1,2,3,or 4 The form is created with
Dim newScreenDisplay As New ScreenDisplay
and has all the usual text boxes and buttons etc. on it.The display is then kept up to date by refreshing it from variables. This task is performed by a background thread.What I can't work out is how to reference the specific instance of the form that I created as they all have the same name (newScreenDisplay).
I'm showing a form like this[code]...
Then I am trying to update a progressbar on that form from a public sub in a module, but I don't know how to reference it. I can't use "Me" because I'm not doing the updating in the forms code
I've been working on a project now for some time and as a result, when I have something new to try out, I do a little "proof of concept" project and then port it over to my real project (mainly to make it easier to follow when trying to work out new issues).Up to now, I've been relatively successful at it.But here's what I'm running into with this particular project.First, a little background.When the operator enters data into certain input fields (textboxes), either a listview or a datagridview appears displaying multiple columns of information.Once the line is selected with the proper info (equip. id or type of job or whatever), that info gets displayed in the textbox.The problem occurs when display is clipped by the window size.Let's assume for simplicity sake that I can't enlarge the display window.
So I rethought that and decided to create another form that has no borders and the only item displayed is a bound dgv.So I created a proof of concept project that consisted of two forms: form 1 that contains a text box and form 2 that contains a dgv control.when run, form 1 is displayed.When I type a character in the textbox, it calls form 2 and searches the dgv for the first char I entered.Since form 2 is the current form, as I enter additional chars, I build the string, search and if the chars are valid input chars, echo them to the textbox.Once the data line on the gridview is found, the tab key is used to do the select, close form2 (the dgv) and populate the textbox of form 1.This all worked.That is until I tried to port it over into my real project.This is where I'm obviously missing some key aspect of VB.Net and how all the forms and threads and handles work.To get right to the issue and skip alot of what happens in my real project, I was able to duplicate the problem by just creating one more form in my proof of concept project that just has a button on it.That button when pressed, brings up form 1.When I start to type in the textbox, after I enter the first character, form 2 displays, which is as expected. But when I enter the second search character, a second instance of form 2 opens and it searchs for the second character I typed.If I enter another character, it gets added to the second char and located in the dgv of the second instance of form2.When I press the tab key, textbox of form 1 does not get updated but the second form2 does close.The first form2 remains.
I have a form (frmResults) that contains a button (btnConsole) which when clicked it tests if the class level variable (cv_frmConsole) is Nothing.If so, it opens a new instance of a form (frmResultsConsole).When the user closes frmResultsConsole,then clicks btnConsole my code throws an exception, because the code below "Else" is run.I want to properly test if an instance of frmResultsConsole already exists.If so, show the form even if the user minimized it or it's hidden.If not, open a new instance.
Public Class frmResults
Private cv_frmConsole As frmResultsConsole = Nothing
Public Sub New[code].....
I have a form template on my IDE, I want to open a new instance of it depending on what button is clicked, how can I do this?
View 18 RepliesIn Windows Forms (Vb.net) how can I access the properties without instance (new) ?Form1.Property = "" ? the property deceleration is not static? what is called this way of deceleration?While you can't access Class1.Property!
View 1 Replies