Keeping Multiple Form Instances Separate?

Sep 16, 2009

When I create more than one instance of the same form and I call a method on any of these instances, the code only fires on the most recently created instance. Even when I click a button on that form, it executes on the other form. How can I call these and keep them as distinct objects?

For example: if I build Form1 with a public method called ChangeMyColor and a button to call that method. Then in the main app I set MyForm1 = New Form1
and MyForm2 = New Form1, then call MyForm1.ChangeMyColor, the color changes on the second instance. Even if I click that button on the first instance, the color still changes on the second.

View 8 Replies


ADVERTISEMENT

Create Separate Object Instances For New Objects In Separate TabPages?

Sep 17, 2010

I have a TabControl object on my form with many tabs created in code (TabPages) and my problem is that the same objects that are in the initial TabPage needs to be in the other TabPages created in code, I have this done in code when the user clicks the 'New Tab' menu option, however the same code is used for any new tabs created. The problem created here is that I have an event against one of the objects that appear in the other TabPages, but because the same code is used to create any new tab pages, the event will only work on the newest tab page, if that makes sense? By the way these objects that appear on the other TabPages are properties at the top so events can be handled against them in the respective subroutine.

[Code]...

View 5 Replies

Keeping Count And Storing Of Text Instances?

Sep 22, 2011

I would like to make a simple code that counts the top three most recurring lines/ text in a txt file then saves that line/ text to another text file (this in turn will be read into AutoCAD's variable system).Forgetting the AutoCAD part which I can manage how do I in VB.net save the 3 most recurring lines of text each to its own text file see example below:

Text file to be read reads as follows:

APG
BTR
VTS

[code]....

The VB.net program would then save the text VTS to mostused.txt BTR to 2ndmostused.txt and APG to 3rdmostused.txt?

View 1 Replies

Multiple Instances Of A Form?

Sep 13, 2010

If I create a console application for example with a class named "Person" I can create an object variable with a ceratin name only once. For example:

Module
Module1
Sub

[Code]....

View 1 Replies

Multiple Instances Of The Same Form?

Mar 3, 2010

I have two forms in my application. Form 1 is a listview that is populated with unique Customer IDs. When the user double click the listview on the particular Customer ID then it loads Form2. Form2 has many listviews within it such as a listview for the Customer telephone, another listview for their addresses etc and all the data presented in Form2 listviews are based on the Customer ID that the user clicked in Form1.

So here is my question...I want the user to be able to open Form2 with that particular details of the customer but also to go back to Form1 and double click another Customer ID and opens Form2 again (such as replicating Form2) with the other Customer details.So the moral of the story is i want the user to be able to have many instances of Form2 open each time they wish to view a different Customer ID without having to close Form2 down every time.

View 3 Replies

Creating Multiple Instances Of A Form?

Aug 12, 2009

I have a form (form1) and I havea button on form1 (button1) that will start a second form (form2).How can I make it create multiple instances of form2 when button1 is clicked?i tried a process module that the studio comes as standard but it does not allow me to start multiple instances...how can i do this?

View 14 Replies

Open Multiple Instances Of Same Form?

Jul 6, 2009

I am writing an application whose main purpose will be to collect user-entered data on a prescribed time interval (to be used by a dr. during anesthesia to collect patient vitals during surgery). I am attempting to accomplish this by having a form opened from the main window on every tick of a timer. The problem, is that if the user is a bit slow in entering the data on the first window, and the timer ticks again before they submit the first form, when the form is reopened (currently by simply using a show() command), the process of opening the form again simply overwrites the original form rather than creating a second instance.What is the best way to open a second (and possibly 3rd, 4th... nth) instance of the same form?

View 4 Replies

Prevent Multiple Instances Of A Form?

Jun 22, 2011

I am working on a project where i have a home form which has two buttons for login for employee and administrator.after clicking on button login form will open,but i want as soon as login window opens d previous home form must be closed or hide..also there is link on login page for home,but as soon as user click on home link new instance of home form is opening,hnce i want to stop dis multiple opening of the form.i tried close() and hide() but no use.[code]...

View 2 Replies

Preventing Multiple Instances Of A Form?

Mar 29, 2009

need help please on how to prevent multiple instances of a form at runtime in vb so tha when a user clicks a button to load a form it loads an if the user clicks the same button again whilst the other instance of the form is running it doesnt open a new one but insted sets focus on the currently running form.br2

View 4 Replies

Single Form With Multiple Instances

Aug 12, 2010

I have a form which displays temperature and humidity data for a device in the field. I have multiple devices. Rather than creating a separate form for each device, obviously it is much better to have a single form that I instantiate, pass data to, and display. The devices are listed in a treeview, and when the user double-clicks the node, I create an instance of the form, pass the device's data to the instance of the form, and display the form. All of this works perfectly. However, I have a challenge: If the form for a particular device is already open, I don't want another one opened when the user double-clicks the node.

However, whenever I place logic in the program to check for the existence of the form and only allow another instance to be created if one doesn't already exist, it prevents me from creating a form instance for any other device that I may wish to view, simultaneously. So, I have a dilemma -- allow the user to display the data for multiple devices, including allowing multiple forms to be open for a single device, OR only allowing one device to be displayed at any given time.

View 2 Replies

Working With Multiple Instances Of The Same Form

Apr 6, 2010

is they a way of keeping track for multiple instances of the same form? example saving the contents of a textbox ,the positition of the form and size when using the code below to create the new instance of the form ,i would like to save the contents of multiple form2`s from form1 ,can it be done??

[Code]...

View 6 Replies

Keeping Dll And Exe In Separate Folder

Apr 1, 2012

I want to create SETUP for vb.net window application. My application uses multiple dll.so I want to keep dll in separate folder and exe in separate folder. When I create setup, dll and exe are in same (Application Folder of setup), then it works, but when I create 2 different folder in Application Folder of setup, one for dll and one for exe, then it desn't work. Please suggest how can I ?when I create set up then all goes to applciaton folder. when i installed then all are installed in same folder.but I need all dll goes to sperate and exe goes to sperate folder.

View 1 Replies

Creating Multiple Form Instances In A Subroutine?

Aug 23, 2010

I am trying to create a subroutine that creates multiple instances of a specific form.

Here is my code:Public Sub NewFormInstance(ByVal FormName As Form)

Dim FormInstance As New FormName
FormName.Show()
End Sub

View 3 Replies

Multiple Instances Of A Single Control On A Form

Apr 6, 2012

I've got two sets of lists with nearly 800 items that I need in 32 different drop down comboboxes (before you ask, that is required and it can't be simplified). Understandably, populating each of them slows down the creation of the form. This happens to be a child form that these drop downs are on and there could be more than one child form displayed. I've assembled the lists in List(Of String) objects and set each of the datasources of the comboboxes appropriately, but it still takes several seconds for them to populate and display for the first time. This is also problematic if the datasource gets updated (items removed, added, renamed) because I have to wipe out all the items and create the list again in all active instances.

[Code]...

View 3 Replies

VS 2005 Multiple Instances Of The Existing Form?

May 7, 2010

I have an MDI parent(MDIParent1) form with a child form(frmMain).The child form got a Tabcontrol(TabControl1) in it.I am trying to load other forms(say form1) in my application to this tabcontrol as tabpages. I use the following code for that

[Code]...

View 2 Replies

VS 2008 Close Multiple Instances Of Form?

Aug 30, 2011

I have 30 instances of the same form running. Video array with different video on each. Each form is named "oneForm". I'm looking for a way to close all forms with one click. I have found that I can hide the forms no problem like this.

for each killfrm as form in my.application.openforms
if killfrm.name = "oneForm" then
killfrm.hide()

[code].....

View 4 Replies

VS 2008 Resize Multiple Instances Of Same Form?

Jan 15, 2009

Within the subroutine, I am counting the number of open Forms and dividing the bounds of the screen by the number of open forms everytime a button is clicked.his gives me a way to Size each video box perfectly according to the number of forms open.This is where I have found a problem. The size of the new window only sizes the newly opened on and will not resize the ones that are already open. I will give an example of my subroutine.Note: Because of the nature of my program, I am not allowed to take any code out of the work zone and so I will be summarizing what I am doing rather than showing the actual code.

Private videoShow (byval videoName, byval videoIp)
dim videoForm as new form
videoForm.size = New Drawing.Size

[code]......

View 11 Replies

Communications :: Keeping Messages Separate On A Connection?

Mar 16, 2011

I'm trying TCP communication using VB.NET and using the TcpClient method.All is working fine but I'm having trouble keeping my message seperate from each other.For example, my message have an header and footer and can range in size from very small (32 bytes) to quite large (64k). The problem I have is that when messages are being sent quickly they will arrive together. For example, if two 32 byte messages are sent they will arrive as 64 bytes. This is no good as I need to process them seperately.

So my question is:- Is there a way to easily separate my messages using a built in feature of the TcpClient so that the "reading" will give me the correct amount of bytes each time corresponding to the amount of bytes I have sent per message?

View 3 Replies

Keeping All Functions And Subs In Separate File?

Mar 4, 2009

When I code in PHP I usually keep my functions in a separate file functions.php, I am going to write a small function in VB, is it ok to keep all my functions and subs in the 1 file linke in PHP? will they be available in all my form code?

View 3 Replies

VS 2008 Awckward Behavior From Multiple Form Instances Loaded Into A Dictionary?

Jul 27, 2009

Ok I have a project which has a MDI parent. Inside the parent I have multiple isntances of a form load(frmLine1t5). When my program loads it will load a different form(frmSelect) and if I manually load a different form(frmRetests) I can put frmSelect on top of frmRetests and bring one another to the front if it's clicked on(without using the bringtofront method)However as soon as I load a single instance of frmLine1t5 I immediately can no longer bring ANY form loaded into the MDI parent(before or after frmLine1t5 has loaded) to the front. I can only bring them to print IF I use .bringtofront method

View 1 Replies

Multi-threading Forms - Open A Separate Form As A Separate UI Thread From The Start Up Form

Oct 27, 2011

I have a few forms that have a lot of really intensive updating along with a great deal of user interface (text boxes, button clicking etc) Is it possible to open a separate form as a separate UI thread from the start up form that called it to "show" or open or whatever the new method might be?

View 6 Replies

Changing And Keeping The BackColor For Multiple Buttons?

Dec 16, 2011

Using VB/VS 2010 and am trying to provide the user with a way to change the color of the control buttons on my main windows form. I'm starting with the button click event that then calls another sub-form (code shown respectively below).

I was testing with DirectCast as I need to deal with a multitude of button controls (i.e., will have more than the two shown below).

I would like to know how to deal with the following:

1. How do I save the BackColor so when the user opens the form for the first time (or any other time thereafter) the color set earlier appears (the default via properties is green).

2. When I click on the button for the first time and change the color it doesn't change until I click the button again.

[Code].....

View 1 Replies

Keeping Dataset In Memory Or Multiple SQL Queries?

Apr 19, 2011

I need to loop through a gridview to find records that match items in a different table (in SQL). Is the best method to loop through the gridview and call an SQL procedure on every loop to find matching records? Or should I pull the entire sql db into a datatable and query the dataset in my gridview loop?

'find source ID based on make/model/serial No combination.
Dim cSource As New clsSource()
Dim ds As DataSet = cSource.GetSources()

[Code].....

View 2 Replies

Copy Multiple Text Files But Keeping Origional Name

Feb 17, 2010

I made an application that searches for an text file and copy it toc: est. But when is find multiple files i cant copy it because it will overwrite the file in c: est *.txt.Is there a way i can copy a file and Keep the origional file name?[code]...

View 16 Replies

VS 2010 Keeping Track Of 'Active' Tabpage With Multiple TabControls?

Aug 11, 2010

I am building a sort of 'lightweight' Visual Studio, and I'm trying to implement the feature where you can drag tabs to different 'tab groups', viewing multiple tabs side by side.

I got nearly everything working, I show a ContextMenuStrip when you rightclick the tab headers, with the option of creating a new (horizontal or vertical) Tab Group. When that happens, a new TabControl is added dynamically and the selected tab is moved there. You can drag the tabs around inside a TabControl and even from one to another.

The problem now is keeping track of the 'active' tab. Since I have multiple TabControls (not just two, there can be as many as you want theoretically), their SelectedTab properties are basically useless. How am I to determine which TabControl the user is currently working in? Obviously I will always have multiple selected tabs, but only one active tab, in which the user is currently typing, editing, whatever.I need to know the active tab for obvious reasons: many menu and toolbar items act on the active tab for example. A short explanation of my controls:I have one TabGroupContainer control, which inherits UserControl. I have a TabGroup control, which inherits TabControl.I have a Tab control, which inherits TabPage.

The TabGroupContainer holds a collection of TabGroups (to which I dynamically add/remove TabGroups when required). Now I want the TabGroupContainer control to have the ActiveTab property which returns the one and only active tab (out of possibly many selected tabs).The only logical way is to keep track of the tab that was selected last, for every TabGroup.

At the moment, I am doing this:

- In the TabGroup (TabControl) class, I shadow the SelectedTab property (and return a Tab instead of a TabPage). More importantly, in the property setter, I raise a SelectedTabChanged event:

vb.net
Public Shadows Property SelectedTab As Tab
Get
Return DirectCast(MyBase.SelectedTab, Tab)

[code]....

However, it still doesn't work. I soon figured out why: I am checking that the previously SelectedTab is not the same as the new value in the property setter of the (shadowed) SelectedTab property. I don't raise the event when they were the same, and in this case they were the same (as there is only one tab in the TabGroup!).So, I took that check out, and now it seems to work when I click in the text editor.

So one problem remains: the active tab is not changed when you click on the tab header (and not on the text editor). I am clueless as to how I should handle this... I am once again sure there is a simple fix, but I cannot see it. I can click the tab header, and I'm sure behind the hood it responds to this click, but it never raises it SelectedIndexChanged event because the index didn't change but was set to the same value it already had. I cannot override the SelectedIndex property (so I could skip this check and raise the event anyway even if the value didn't change), and the OnSelectedIndexChanged method is not called, so I cannot use that either...

View 6 Replies

Connecting To Multiple SQL Instances?

Jan 3, 2011

Any best method of managing multiple SQL connections .net (VB). My application connects to four instances of SQL Server (2000, 2005, 2008, 2008R2) restoring databases, modifying data and taking backups. In addition to managing databases the app also has its own DB (on the 2008 instance) for storing various data. I'm using two methods to connect to the instances, SMO (For backups, restoring and retrieving information about the databases, size etc) and SqlClient for querying each database for many tasks such as updating fields and executing sql scripts.I have multiple forms for performing various tasks so there are many places I'm opening / closing connections.

Would it be best to maintain a persistent global connection to each instance from the application? (Two in total, one for SMO and the other for SqlClient) or open close a connection for each task I'm performing?) I'm not using LINK as I need the tasks to be as fast as possible. The connection string will differ on each connection (Based on Instance and Database being connected to) how would I manage this? A string in the config file for the applications database would make sense, as that would be static but the databases being worked on will vary with each connection. Currently I'm creating a connection for each instance within the main form:

Dim 2000Connection = New SqlConnection("Data Source=" & SQLServerName & _
"SQL2000;Initial Catalog=Master;User ID=sa;Password=P@ssw0rd;Pooling=True;")
Dim 2005Connection = New SqlConnection("Data Source=" & SQLServerName & _
"SQL2005;Initial Catalog=Master;User ID=sa;Password=P@ssw0rd;Pooling=True;")
Dim 2008Connection = New SqlConnection("Data Source=" & SQLServerName & _
"SQL2008;Initial Catalog=Master;User ID=sa;Password=P@ssw0rd;Pooling=True;")
[Code] .....

View 1 Replies

Multiple Instances Of Class?

Mar 29, 2010

I have the following problem. (VB.Net 2008)I have created a class (myFirstClass). In this class there are a lot of calculations being made wich gets fired by events in that same class.Now i want that same class to be able to fire more instances of itself. However i noticed that each time i fire an event from a Sub the program waits till the event is finished before going to the next line of code. This is a problem since i want the event wich fires a new instance of the class to fire it and forget about it.

View 7 Replies

VS 2008 X86, X64, PID, Multiple Instances?

Feb 6, 2010

My ultimate goal is to get a list of PIDs and have a user select 1 of them.For example: the process image name is program.exe. The application name varies for each instance the program.exe is run, and therefor each application name has its own PID associated with it. By application name I mean the Task name under the Applications tab of Windows Task Manager. Another issue I face is that some systems run x64, so the name is no longer program.exe but program.exe*32

So my issue is, how do I search for program.exe, or on x64 platforms program.exe*32, and if there are multiple instances of program.exe/program.exe*32 running, how can I get a list of PIDs for each and associated them with the application name as the Task name under the Applications tab of Windows Task Manager.that might sound a bit confusing! So if it is, please let me know and I will try to explain more. Any reference guides or example code would be greatly appriciated as I have only used the "System.Diagnostics" but once.

View 2 Replies

VS 2010 - Keeping Files / Folders Synchronized Across Multiple Client Computers

Aug 10, 2011

(Currently using VB.NET 2010 Express) I'm trying to make a program, the main of which is file transfer. I'm trying to create a program that will keep files and folders synchronized across multiple client computers. I'm using a File system watcher to trigger events, and Using a simple System.Net.Sockets UDP client transfer (found via google) to transfer commands between it and itself on other computers.

Here's that code (this just sends from one textbox to another over the internet)
Imports System.Net.Sockets
Imports System.Net
Imports System.Text
Dim udpClient As New UdpClient(1024)
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
[Code] .....

By this method, I can rename, move, or delete files. I want to implement file transfer, so that whenever a new file is created, or updated, my program will automatically transfer the file to the other computers and update them there.

View 3 Replies

Adding Multiple Instances Of Same Control

Jan 14, 2011

I have a control which consists of a couple of labels and a couple of buttons side by side.I want to add multiple instances of this control to a panel.The problem I have is with positioning/formatting.Whenever I add the control it just gets added on top of the previous one.Should I be using something other then a panel? Are there any tips ot tricks I should be aware of ?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved