I open a form and initialize a function in that form. A progress bar is running. Then i hide the form with the same function. Now I need to show the window from another project with the same progress bar values. Is it possible to call the same form with out new keyword?
Note: My function which is used to hide the form is in VB.NET and function which is going to show the form is in C#.net
Here my code VB.NET (function going to hide the window)
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim objUpload As New UploadingList
objUpload.Show()
objUpload.Hide()
objUpload.UploadFiles()
End Sub
This uploadfiles() function initialize the progress bar and uploading the files.
so if i need to show the window from C# project, how can i do? if i create a new project, the progressbar values also get to default. Any solutions to this problem?
private void btnFiles_Click(object sender, EventArgs e)
{
ICloudProvider.UploadingList objUpload = new ICloudProvider.UploadingList();
objUpload.Show();
}
If i follow the above function in C# all the control get to its default value. So there is no progress in progress bar.
Create a public shared variable on the form to store a reference to the instance created in the VB program.
The form would have the following line:
When you create the form, you need to set this variable:
Now from your C# program, instead of creating a new instance of the form, you would simply use the existing one:
Remember to set the Instance variable to null (nothing in VB) when the form is closed.