473,387 Members | 1,611 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,387 software developers and data experts.

how to set set var to current instance of object?

Is it possible to set a variable to a current instance of
a running object without using the New keyword?

Here is my situation. I have been trying to add a record
to a dataset on a Parent Mdi form and refresh a datagrid
on this parent at the same time from a childform. I could
not make this happen. The only way I could refresh the
parent form/datagrid was to reset the datagrid datasource
from within the parent. Then I determined that I was
instantiating a New copy of the parent form because I was
using the New keyword in the childform. So I created a
global Form variable in a Module. Essentially, I want to
bridge the parent and childform (is that called
marshalling?). So when the childform is created it is
automatically bridged to the current instance of the
parent form. Is this possible? If so, what is the
correct syntax?

TIA
Adda
Nov 20 '05 #1
5 1631
Hi,

Dim frm as Form1 = Me.MdiParent. Replace form1 with the name of
your mdi parents name.

Ken
-------------
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:1b*****************************@phx.gbl...
Is it possible to set a variable to a current instance of
a running object without using the New keyword?

Here is my situation. I have been trying to add a record
to a dataset on a Parent Mdi form and refresh a datagrid
on this parent at the same time from a childform. I could
not make this happen. The only way I could refresh the
parent form/datagrid was to reset the datagrid datasource
from within the parent. Then I determined that I was
instantiating a New copy of the parent form because I was
using the New keyword in the childform. So I created a
global Form variable in a Module. Essentially, I want to
bridge the parent and childform (is that called
marshalling?). So when the childform is created it is
automatically bridged to the current instance of the
parent form. Is this possible? If so, what is the
correct syntax?

TIA
Adda

Nov 20 '05 #2
I figured it out! For everyone who has been helping me on
this, that was painful! :). I instantiate a New
Parentform variable in Sub Main. Then I can use that in
the children forms!.

Adda

-----Original Message-----
Is it possible to set a variable to a current instance of
a running object without using the New keyword?

Here is my situation. I have been trying to add a record
to a dataset on a Parent Mdi form and refresh a datagrid
on this parent at the same time from a childform. I couldnot make this happen. The only way I could refresh the
parent form/datagrid was to reset the datagrid datasource
from within the parent. Then I determined that I was
instantiating a New copy of the parent form because I was
using the New keyword in the childform. So I created a
global Form variable in a Module. Essentially, I want to
bridge the parent and childform (is that called
marshalling?). So when the childform is created it is
automatically bridged to the current instance of the
parent form. Is this possible? If so, what is the
correct syntax?

TIA
Adda
.

Nov 20 '05 #3
Thank you. This is even better because now I don't need
sub Main(). I suppose the hardest part of this project
was trying to communicate what I needed/was looking for.

Many thanks for your help.
Adda

-----Original Message-----
Hi,

Dim frm as Form1 = Me.MdiParent. Replace form1 with the name ofyour mdi parents name.

Ken
-------------
"Adda" <an*******@discussions.microsoft.com> wrote in messagenews:1b*****************************@phx.gbl...
Is it possible to set a variable to a current instance of a running object without using the New keyword?

Here is my situation. I have been trying to add a record to a dataset on a Parent Mdi form and refresh a datagrid
on this parent at the same time from a childform. I could not make this happen. The only way I could refresh the
parent form/datagrid was to reset the datagrid datasource from within the parent. Then I determined that I was
instantiating a New copy of the parent form because I was using the New keyword in the childform. So I created a
global Form variable in a Module. Essentially, I want to bridge the parent and childform (is that called
marshalling?). So when the childform is created it is
automatically bridged to the current instance of the
parent form. Is this possible? If so, what is the
correct syntax?

TIA
Adda

.

Nov 20 '05 #4
* "Ken Tucker [MVP]" <vb***@bellsouth.net> scripsit:
Dim frm as Form1 = Me.MdiParent. Replace form1 with the name of
your mdi parents name.


With 'Option Strict On':

\\\
Dim frm As Form1 = DirectCast(Me.MdiParent, Form1)
///

:-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5
Thank you. Yes, I had to deal with that. I am using
Option String On. I am starting to get the idea about
VB.Net syntax.

-----Original Message-----
* "Ken Tucker [MVP]" <vb***@bellsouth.net> scripsit:
Dim frm as Form1 = Me.MdiParent. Replace form1 with the name of your mdi parents name.


With 'Option Strict On':

\\\
Dim frm As Form1 = DirectCast(Me.MdiParent, Form1)
///

:-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
.

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Francois Malgreve | last post by:
hello guys, I have some helper class in my ASP.NET pplication who basically contains static methods. I used them as helper methods to do small jobs that I can use at many places in my code. ...
3
by: xzzy | last post by:
A. I need to access: System.Web.HttpContext.Current.Cache but get this error: "Object reference not set to an instance of the object" B. System.Web.HttpContext.Current.Cache is accessible...
8
by: eric | last post by:
I have a 2.0 asp.net project. In a class contained within a seperate project, I am trying to reference HttpContext.Current.Session but Session is always null. I've tried implementing...
8
by: SpaceMarine | last post by:
hello, my web app form has many DropDownLists that pull their content from a database. these calls are in a Business Access Layer, when first checks the context's Cache object for existing...
5
Sl1ver
by: Sl1ver | last post by:
I have this piece of code public bool Write(string KeyName, object Value) { try { // Setting string subKey1 =...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.