Calling Form By Using As New?
Dec 13, 2009
I am just wondering the difference between using "As New" and not using it. It looks like the outcome is same to me. Is there any difference between #1 and #2 when I call "frmCR" from other winform?
A form "frmCR" is alreadu created thru design mode.
#1
Dim frmCR As New frmCR
frmCR.Show()
#2
frmCR.Show()
View 7 Replies
ADVERTISEMENT
Aug 7, 2009
I'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:
View 10 Replies
Sep 6, 2010
Requested were made by Businese Analyst to set the few Main FORMs VISIBLE PROPERTY TO FALSE when the POPUP FORM is loaded.
[Code].....
When the MAIN FORM loads the POPUP FORM, on the FRMPOPUPCUSTOMER-FORMLOAD even, it has to set the MAIN FORM Visible to False.
When FRMPOPUPCUSTOMER FORM IS UNLOAD it has to set the MAIN FORM Visible = TRUE.
How to the coding is to ensure that different MAIN FORM when loaded FRMPOPUPCUSTOMER it will turn the MAIN FORM Visible to FALSE.
View 2 Replies
Jul 22, 2009
how to call a function from a different form. Like the button click event. i have this scenario. I have a main form and a child form in the main form there is a navigation panel on the left side controlling the child form. What i want is if clicking the add record in my navigation panel will call a function in the child form to execute.
View 1 Replies
Sep 21, 2010
I have two forms and one needs to call a method from another form. I am from a java background so i do not understand why the object instaniated (if that is a correct assessment) on one form cannot Call a sub from the second form.
View 1 Replies
Mar 2, 2009
i used the code below to find if any forms called logform are open, there will only ever be one of these open at a time...
Code:
Dim frm As Form
For Each frm In My.Application.OpenForms
If frm.Name = "logform" Then
MsgBox("found form")
[code].....
but thing is when i find the form i want to call a sub in that form's code called action if i use frm.actions() it says that actions() is not a member of [URL]so how do i do this?
View 14 Replies
Mar 11, 2010
I have login form as start up form and i call Form1 after successful validation and in Form1, i have close button on click of Close i would like to reset username and password fields on loginform to null. If i add code in form1 below i get exception Dim fmLogin As New LogInForm
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
Make sure you do not have an infinite loop or infinite recursion
I get above on LoginForm below statement Dim fmMain As New Form1
How to take care of this problem
View 1 Replies
Sep 2, 2011
Is it advisable to call a function from another form?Does it have any side effects on the system while running, like more process will consume?I have a function that will set the background in a form, it will make the image stretch, backcolor transparent and will set the picture. If I will use that function in other 15 FORMS I can minimize my code.
View 9 Replies
Jun 26, 2011
Version: visual basics 2008
Problem:
Form 1 contains a SWF object, which is called FlashGame (it has a movie set, which is a game)
Form 2 contains a button to set a variable on the FLashGame.
Example
Call FlashGame.SetVariable("variable will be here", 1)
That simple coding works when the button to call that SetVariable command is on the same form as the FlashGame, but I need them to be on different forms.
View 1 Replies
Jun 29, 2009
The code below is what I have in one form. Login_prompt is the name of the other form.In this code snippet I am displaying another form that prompts the user for a username and password.I then want to open the website and auto populate the fields. The populating is not the problem.I cannot seem to call on the other form's sub procedure correctly.
View 3 Replies
Jan 19, 2011
Is there any specific way of calling the form of another application.My main project is a WPF application.From that it is calling another application is Vb.NET.. This is done by creating a process and then calling the exe.
Dim fp1 As New Process()
fp1.StartInfo = New ProcessStartInfo("Location of the exe")
fp1.Start()
Now the problem which I am facing is that from that exe I need to call a specific form in the WPF application.
View 2 Replies
Jun 25, 2010
i am currently trying to re-write an old VB6 program into .net basically the program contains 100's of forms for different jobs each with a Public Sub runjob(). the form names are then stored on a database. the user then selects the job from the listbox and it calls the correct job.the code i use to use in vb6 was
sValue = database.rsselectjobrun.Fields("callname")
Set frmName = Forms.Add(sValue)
frmName.runjob
Set frmName = Nothing i have looked into it and found this code which calls the form in .net
Dim objForm As Form
Dim sValue As String
Dim FullTypeName As String
[code]....
but i cannot get this to run anything other then the formload code. i know i can put all of this into a select case module but id rather not with the amount of forms i would have.
View 4 Replies
Jul 14, 2010
There are 2 forms open for the user in a school attendance program. The 1st. form is called FormBrowseClasses and the other form is called FormBrowseGrades. On the 2nd form is a procedure called PopulateTheDataGridWithData. That procedure loads data into a DataGrid.We would like to call PopulateTheDataGridWithData from within FormBrowseGrades so the data in the DataGrid will be refreshed.
We already tried:
' Refresh DataGrid data on FormBrowseClasses
'-------------------------------------------
objFormBrowseClasses.PopulateTheDataGridWithData()
but this only runs on a new instance of the form, not the currently open form. how to set this up correctly?
View 2 Replies
Apr 18, 2012
What is the difference between these?
A.) Using xForm as New frmCall()
xForm.ShowDialog()
End Using
B.)Dim xForm as new frmCall()
xForm.ShowDialog()
xForm.Dispose
C.) frmCall.Show()
They are all showing the form and I know it has difference but I don't know what. Can somebody explain this?
View 2 Replies
Jun 14, 2010
Is there anyway I could set an image on a "NEW" child form when calling the following
(MainFrm) = Form1
(ConfigFrm) = form2
Code:
Dim Frm as New ConfigFrm()
ConfigFrm.Img_Artwork.image = Image.fromfile(Img_Location)
Frm.MdiParent = MainFrm
Frm.show
When I call the following, and the "New" child form gets called, The picturebox is left blank. I know it's because I'm calling "NEW" but is there anyway to still add the image to the picturebox even though i call "NEW"
View 7 Replies
Jul 7, 2009
I have an MDI form with 3 nested children with in it. As of right now all it can do is display a new form.For example: each time I press the menu button, the new child form(Form1) is created. Now, if I press that same menu button a second or subsequent time a new Form1 is created and it appears over the previous one.
What I would like is that each time the event handler is triggered (a menu item_click on the parent form) that instead of a completely "new" child form being produced(a new window popping up) it would instead pull up the appropriate child form that is attached to the trigger.
[Code]...
View 2 Replies
Oct 8, 2009
I have datagrid in which the 0th column has ID. What i want is while clicking on the datagrid the id of the particular row has to be load in the variable in the second form. For this i have created a public variable in the second form [code]but here its not returning any value to EditID while loading the second form.
View 1 Replies
Jun 7, 2011
I have a mdi application that allows the user to click on a specific report from them Report Menu's. I am calling the report from main, so far this is my code. In this block of code I am calling the report and connecting to the database from the subroutine called libraryReports_click
Using dbConnection As New SqlConnection(strConnection)
Try
dbConnection.Open()
Dim strSelect As String = strSelectionCriteria
[code].....
I get an error everytime i try to load my report, it gives a report load failed error message. BTW I am meaning to change the msgbx to messagebox.show once i get this piece running. I don't know what could be the issue. Any assistance would be great. I think it may have something to do with my sql adapter.fill method.
View 1 Replies
Jan 13, 2011
I am having problem closing current form when I call some other form from current one.For example when I use code [code]It closes the current form but does not call frmExam.vb.
View 1 Replies
Apr 3, 2012
I have an original assignment that works fine, now I need to go back and make it into classes. I am not 100% how to do this. My issues are with calling the classes to be used in the main form, and what to put into the classes.
I will post the original working assignment and my understanding of the classes.
[Code]...
View 7 Replies
Nov 23, 2011
I have defined a function on one form. I have to call that function again on another form. Is there any way I can do it without redefining the function again and again?
View 2 Replies
Jul 1, 2010
Given vba's fairly lamentable image manipulation abilities, I'm considering going down the VB.NET form route. My hope would be to allow some degree of interactive manipulation and then either pass the image back to vba or save it and load it in vba.I'm happy to investigate the latter part of it at length under my own steam - however, I'm not versed enough in VB.NET forms to know if calling them from (in this case) Access VBA is a practical or doable - and whether it's possible to pass data back and forth.
View 9 Replies
Sep 3, 2009
I have a form with a list box. I'm calling it as a dialog. I can get the result of which button was pressed (OK/Cancel) but how do I get the value chosen from the list?
Dim frmCreateCSVFile As New CreateCSVFile
frmCreateCSVFile.dtpFirstEndDate.Value = dtpFirstEndDate.Value
frmCreateCSVFile.dtpLastEndDate.Value = dtpLastEndDate.Value
[code]......
View 1 Replies
Nov 24, 2009
I have a form which calls other form to achieve some functionality. How can I pass values obtained on other form to the calling form?
View 10 Replies
Jun 10, 2011
I'm writing a program in vb.net 2003 and have come up with a problem.
I have a sub SettingsSave() in a module.
Public Sub SettingsSave()
Dim frmSaveSettings As New frmSettings
MsgBox frmSaveSettings.txtName.Value 'for testing purposes
SaveSetting("MyApp", "configs", "Name",frmSaveSettings.txtName.Value)
SaveSetting("MyApp", "configs", "Pass",frmSaveSettings.txtPass.Value)
End Sub
I have a form frmSettings, which has a button btnSave. When the button is clicked, SettingsSave() is called.The problem is, if btnSave is clicked, then either of the two textbox values are changed, then btnSave is clicked again, the SettingsSave() sub still returns the 'old' values (from the first time the save button was clicked).How do I clear the old values from memory? I've tried adding frmSaveSettings = Nothing, and frmSaveSettings.Close at the end of the sub SettingsSave().
View 5 Replies
May 25, 2010
I have 2 forms FORM 1 and 2 i got this code in form 1
vb.net
Private Sub starauto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles starauto.Click
form2.Button1.Value = True
form2.Button1_Click()
End Sub
but both examples give me an error
error 1.- 'Value' is not a member of 'System.Windows.Forms.Button'.C:Documents and SettingsleijaiMy DocumentsVisual Studio 2008ProjectsIp On or OffIp On or Offform1.vb239Ip On or Off
Error 2.- Error3Argument not specified for parameter 'sender' of 'Public Sub Button1_Click(sender As Object, e As System.EventArgs)'.C:Documents and SettingsleijaiMy DocumentsVisual Studio 2008ProjectsIp On or OffIp On or Offform1.vb249Ip On or Off
error 3.- Error2Argument not specified for parameter 'e' of 'Public Sub Button1_Click(sender As Object, e As System.EventArgs)'.C:Documents and SettingsleijaiMy DocumentsVisual Studio 2008ProjectsIp On or OffIp On or Offform1.vb249Ip On or Off
View 6 Replies
Aug 26, 2011
I'm having trouble on calling a public sub on another form. Here is the sub:
Public Sub BOTAO_NUMERICO(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles N0.Click, N1.Click, N2.Click, N3.Click, N4.Click, N5.Click, N6.Click, N7.Click, N8.Click, N9.Click
Dim Res_ant As String
Dim Res_atu As Double
If (Res <> 0) Then
[Code] .....
On form Normal, BOTAO_NUMERICO works fine, but on Cientifica it don't.
OBS: All objects on both forms are the same, with same name.
View 2 Replies
Dec 1, 2009
I have 2 forms, main Form1 and a loginform. When I start the application, first "Form1" is loaded and then with a button click, user can load "loginform" if required to enable/disable some features/controls on Form1.The sequence is like this:
1) Load main form Form1
2) click a button on Form1
3) Load the loginform.
4) enter user/pwd and click OK button
5) enable/disable "GroupBox" control on Form1 if login sucessful.
For this,I made a click event for OK button in loginform, so once user clicks the OK button, I want to call one function which is defined in Form1 as a Public, which enables/disables the "GroupBox" control on Form1. The code structure is like this:in main Form1, i created a function like this:
Class Form1()
Public Function DoThis() ' Function to enable/disable GroupBox control
....some task...
[code]....
I am not able to call the DoThis() function in loginform. Please suggest me with a piece of code how to do this?? remember that Form1 is my main form which is loading first.
View 5 Replies
Jun 7, 2010
I have a MDI app that I am creating. It, of course, will have multiple MDI child forms. In each child form, I have an options button so that each child form can have it's own set of options. When I click the options button it opens an Options form. This options form is not an MDIChild.
I have a class that contains the child forms options. I pass this class to the options form using a constructor. This is how I call the options form:
Dim dlgPatternOptions As dlgOptions = New dlgOptions(thisPatternOptions)
thisPatternOptions is the class that I am passing to the Options Form.
This works fine and the options form does populate the options correctly. The Options form constructor is this:
Public Sub New(ByRef thePatternOptions As CanvasOptions)
Me.InitializeComponent()
Me.txtCanvasWidth.Text = thePatternOptions.CanvasWidth.ToString
Me.txtCanvasHeight.Text = thePatternOptions.CanvasWidth.ToString
End Sub
I change the options in the options form. How can I get those changes back to the calling form? Do I need to somehow pass a handle of the calling form to the constructor to get the changed values back to the calling form? Is there some way to pass a handle to the options form so that changes made to options will be pushed back to the calling form?
View 2 Replies
Sep 29, 2010
control that contains a button. the user control is placed on my main form. when the button on the user control is clicked I need to to call a method that is located in the mainform.vb
View 2 Replies