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

object reference

In VB6 I use to call controls in another form by:

With frmTaskList.lvwTask

Select Case .Visible

Case True

.Items(1).SubItems.Add("dd")

End Select

End With

VB.NET tells me "Reference to non-shared member requires an object
reference".

How do you do it in VB.NET?

Nov 20 '05 #1
5 1045
In VB.NET a form is a type by itself
You can try this

Dim myfrmTaskList as frmTaskList
When you create the frmTaskList set myfrmTaskList to that instance and then
you can yse it as below

with myFrmTaskList
.....
end with

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Simon Morris" <nz*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
In VB6 I use to call controls in another form by:

With frmTaskList.lvwTask

Select Case .Visible

Case True

.Items(1).SubItems.Add("dd")

End Select

End With

VB.NET tells me "Reference to non-shared member requires an object
reference".

How do you do it in VB.NET?

Nov 20 '05 #2
Addintion: If you use that code in the form itself you can use Me keyword to
call into form's instance

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Crirus" <Cr****@datagroup.ro> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl...
In VB.NET a form is a type by itself
You can try this

Dim myfrmTaskList as frmTaskList
When you create the frmTaskList set myfrmTaskList to that instance and then you can yse it as below

with myFrmTaskList
....
end with

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Simon Morris" <nz*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
In VB6 I use to call controls in another form by:

With frmTaskList.lvwTask

Select Case .Visible

Case True

.Items(1).SubItems.Add("dd")

End Select

End With

VB.NET tells me "Reference to non-shared member requires an object
reference".

How do you do it in VB.NET?


Nov 20 '05 #3
In dot net,form is an object.
For example ,you create form A and form B.
And now ,you want to call A's controls in B.
You can use :
Dim myForm as new frmTaskList
and then ,change your code to
**** With myForm.lvwTask****
I am sorry that I am not good at English.


-----Original Message-----
In VB6 I use to call controls in another form by:

With frmTaskList.lvwTask

Select Case .Visible

Case True

.Items(1).SubItems.Add("dd")

End Select

End With

VB.NET tells me "Reference to non-shared member requires an object reference".

How do you do it in VB.NET?

.

Nov 20 '05 #4
I have try this but myFrmTaskList = Nothing.

Simon

"Crirus" <Cr****@datagroup.ro> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl...
In VB.NET a form is a type by itself
You can try this

Dim myfrmTaskList as frmTaskList
When you create the frmTaskList set myfrmTaskList to that instance and then you can yse it as below

with myFrmTaskList
....
end with

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Simon Morris" <nz*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
In VB6 I use to call controls in another form by:

With frmTaskList.lvwTask

Select Case .Visible

Case True

.Items(1).SubItems.Add("dd")

End Select

End With

VB.NET tells me "Reference to non-shared member requires an object
reference".

How do you do it in VB.NET?


Nov 20 '05 #5
You must assign it to you form instance somewhere

If you create the class after form you can use it's new to set the class
myForm to the Form instance.

Without a larger view of the code I cant tell you more

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Simon Morris" <nz*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have try this but myFrmTaskList = Nothing.

Simon

"Crirus" <Cr****@datagroup.ro> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl...
In VB.NET a form is a type by itself
You can try this

Dim myfrmTaskList as frmTaskList
When you create the frmTaskList set myfrmTaskList to that instance and

then
you can yse it as below

with myFrmTaskList
....
end with

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Simon Morris" <nz*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
In VB6 I use to call controls in another form by:

With frmTaskList.lvwTask

Select Case .Visible

Case True

.Items(1).SubItems.Add("dd")

End Select

End With

VB.NET tells me "Reference to non-shared member requires an object
reference".

How do you do it in VB.NET?



Nov 20 '05 #6

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

Similar topics

6
by: Chris S. | last post by:
I'm trying to make a graphical editor and browser for Pickled files. One aspect I'm not sure about is how to detect multiple references to the same data. For instance, say I had the Pickled...
28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
29
by: web1110 | last post by:
If I have 2 variables, A and B, referencing the same object and then do a A.Dispose(), what happens to B?
5
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: ...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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.