473,425 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Set Calling FORM Visible = False by CALLED FORM

126 100+
Hullo Good Friends,
I need your help. Please Help me.

I am trying to pass the name of the Calling FORM FRMSALES to the Loaded FORM FRMPOPUPCustomers so that FRMPOPUPCustomer will set the FRMSALES visible to FALSE.

I am not sure how to do it. FRMPOPUPCustmer does not turn FRMSALES visible to FALSE.

Here are the coding from Both FORMs:

Expand|Select|Wrap|Line Numbers
  1. '--------------------------------------------------------------
  2. ' FORM        : FRMSALES.VB
  3. ' Description    : This form load FrmPOPUPCustomer to retrieve specific customer
  4. '           or Create New Customer
  5. '----------------------------------------------------------------
  6.  
  7.  Private Sub  ToolStripMenuItem_Click(ByVal sender As System.Object, _
  8.                   ByVal e As System.EventArgs) _
  9.                   Handles ToolStripMenuItem.Click
  10.  
  11.         Dim FM As New FrmCityRef
  12.         Dim callFrm As New FrmCustMaint
  13.  
  14.         FM.PropCallForm = callFrm
  15.         FM.ShowDialog()
  16.         FM = Nothing
  17.  
  18.  End Sub
  19.  
  20.  
Expand|Select|Wrap|Line Numbers
  1. '------------------------------------------------------------
  2. ' FORM         :FRMPOPUPCUSTOMER.VB
  3. ' Description    : This form uses DataGridView and TEXTBOX to create new customer record
  4. '             : It will set the CALLING FORM visible to FALSE
  5. ' --------------------------------------------------------------
  6. Option explicit ON
  7. Dim  FrmCall As Form
  8.  
  9.   Private Sub FRMPOPUPCUSTOMER_Load(ByVal sender As System.Object, _
  10.     ByVal e As System.EventArgs) _
  11.         Handles MyBase.Load
  12.  
  13.          FrmCall.Visible = False     
  14.     End Sub
  15.  
  16. Public Property PropCallForm() As Form
  17.         'retrieve calling form name to set visible off
  18.         Get
  19.             Return FrmCall
  20.         End Get
  21.  
  22.         Set(ByVal value As Form)
  23.             FrmCall = value
  24.         End Set
  25.  End Property
  26.  
  27.  Private Sub FRMPOPUPCUSTOMER_FormClosed(ByVal sender As Object, _
  28.     ByVal e As System.Windows.Forms.FormClosedEventArgs) _
  29.     Handles Me.FormClosed
  30.  
  31.         FrmCall.Visible = True
  32.  
  33. End Sub
  34.  
  35.  
  36.  
  37.  
Sep 6 '10 #1

✓ answered by Joseph Martell

I think you are pretty close to getting this working. I believe your problem is with the form that you are passing to the called form. In your ToolStripMenuItem_Click code, you have the following lines of code:

Expand|Select|Wrap|Line Numbers
  1.          Dim FM As New FrmCityRef
  2.          Dim callFrm As New FrmCustMaint
  3.  
  4.          FM.PropCallForm = callFrm
  5.          FM.ShowDialog()
  6.          FM = Nothing
Notice that what you are doing is creating a NEW FrmCustMaint form and passing it to the called form. When you use the keyword "New" it creates a new object that has no relationship to any forms that are currently being displayed. I assume that the ToolStripMenuItem_Click method is a member of the form that you wish to hide. If so, instead of creating a new form and passing that in you need to pass in Me:
Expand|Select|Wrap|Line Numbers
  1.          Dim FM As New FrmCityRef
  2.  
  3.          FM.PropCallForm = Me
  4.          FM.ShowDialog()
  5.          FM = Nothing

2 1315
Joseph Martell
198 Expert 128KB
I think you are pretty close to getting this working. I believe your problem is with the form that you are passing to the called form. In your ToolStripMenuItem_Click code, you have the following lines of code:

Expand|Select|Wrap|Line Numbers
  1.          Dim FM As New FrmCityRef
  2.          Dim callFrm As New FrmCustMaint
  3.  
  4.          FM.PropCallForm = callFrm
  5.          FM.ShowDialog()
  6.          FM = Nothing
Notice that what you are doing is creating a NEW FrmCustMaint form and passing it to the called form. When you use the keyword "New" it creates a new object that has no relationship to any forms that are currently being displayed. I assume that the ToolStripMenuItem_Click method is a member of the form that you wish to hide. If so, instead of creating a new form and passing that in you need to pass in Me:
Expand|Select|Wrap|Line Numbers
  1.          Dim FM As New FrmCityRef
  2.  
  3.          FM.PropCallForm = Me
  4.          FM.ShowDialog()
  5.          FM = Nothing
Sep 7 '10 #2
lenniekuah
126 100+
Hi Joseph Martell
Thank you very much for your suggestion. I did try it out and it's working.
I have to modify it to suit our setup.

I would like to post it here to share it with others who may have similar problems and need help.
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnCustomer_Click(ByVal sender As System.Object, 
  2.     ByVal e As System.EventArgs) Handles btnCustomer.Click
  3.  
  4.         Dim FM As New FrmCustMaint
  5.         Dim callFrm As System.Windows.Forms.Form = Me
  6.  
  7.         FM.PropCallForm = callFrm
  8.         FM.ShowDialog()
  9.         FM = Nothing
  10.     End Sub  
---------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Option Explicit On
  2.  
  3. Public Class FrmCustMaint
  4.  
  5.     Dim FrmCall As System.Windows.Forms.Form
  6.  
  7.      Private Sub FrmCustMaint_Load(ByVal sender As System.Object, 
  8.         ByVal e As System.EventArgs) Handles MyBase.Load
  9.  
  10.                 FrmCall.Visible = False
  11.     End sub
  12.  
  13.      Public Property PropCallForm()
  14.                 Get
  15.                         Return FrmCall
  16.                 End Get
  17.                 Set(ByVal value)
  18.                         FrmCall = value
  19.                 End Set
  20.         End Property
  21.  
  22. End Class 
Sep 8 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: hanct | last post by:
"this" here refer to the form.. I type this.Visible=false;..but the form still can be seen! Worst still, the property editor has no Visible property to play with..why??is that a bug?? Wat the...
4
by: bnp | last post by:
Hi All, I am quite new the JavaScript. Basically I am a C++ programmer, but now I am working on JavaScript since last 5 days. I have a problem regarding the form validation. I have created a...
4
by: pizzy | last post by:
INTRO: I tried to clean it up for easy reading. I hope I didn't make any mistakes. PROBLEM: WOW, this is some crazy sh!t. I can't get my checkbox (see "TAGSELECTED") to print my textboxes (see...
5
by: DraguVaso | last post by:
Hi, I have a MDIForm with some MDIChilds. When the user clicks on the "x" in the upper right corner, I don't want the MDIChild to be closed, but the property Visible = False. So far no...
8
by: Hansen | last post by:
Hi I have a form with multiple labels and textboxes and listboxes that need to be made visible and not visible when buttons are clicked. Is there anyway of grouping them together so that I have...
4
by: Jimmy Stewart | last post by:
I have a calculated control "ContactInfo" on my form ... ="Attn: " & In the OnCurrent event for the form I have the following code... If Me.Contact Is Null Then Me.ContactInfo.Visible = False...
5
by: | last post by:
How can i make my form invisible public class Form1 : System.Windows.Forms.Form static void Main() {
8
by: Doc John | last post by:
I have an MDI container with a child Form which will be visible according to certain events. The problem is that when I set the property Visible to False and then back to True, the Form will be in...
2
by: Thelma Roslyn Lubkin | last post by:
If I close and reopen the form I lose its changes even if I set acSave to yes when closing. So I'm trying to keep the form open throughout but making it visible only when necessary. So how...
6
by: mjworks2009 | last post by:
I'm creatig a data base and in my front page i have 3 sub forms and 3 buttons for the sub forms to activate or not. 1. Subform1 is where all the current list of the patients being admitted for...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.