| | |
Help with "My" functions!
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Oct 2006
Posts: 3
Reputation:
Solved Threads: 0
Hi, I am trying to use the "My" functions in Visual basic, but every time i run the code, it give me a Runtime error 424 - object required.
I am a newbie at this, please help.
I don't have anything else in the code, just New Project, Stantard EXE project, then in the Form1, i have this code
Private Sub Form_Load()
MsgBox ("Computer name: " & My.Computer.Name)
End Sub
When i run, it give me the error, I think i have to do something first before i use the My.Computer.Name, but i don't know what, i tried search MSDN but can't find the steps on how to use it. Thanks for the help.
I am a newbie at this, please help.
I don't have anything else in the code, just New Project, Stantard EXE project, then in the Form1, i have this code
Private Sub Form_Load()
MsgBox ("Computer name: " & My.Computer.Name)
End Sub
When i run, it give me the error, I think i have to do something first before i use the My.Computer.Name, but i don't know what, i tried search MSDN but can't find the steps on how to use it. Thanks for the help.
What is "My" ? As far as I know there is no in-built VB object called "My". If you are trying to use an object you created then you have to include the reference to that object.
For example If you have created an object called myObject which has a property called ComputerName then the code should be like
For example If you have created an object called myObject which has a property called ComputerName then the code should be like
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim my as new myObject Msgbox my.ComputerName
•
•
Join Date: Oct 2006
Posts: 3
Reputation:
Solved Threads: 0
There is such object, it is listed in the MSDN
http://msdn2.microsoft.com/en-us/library/11bxex12.aspx
http://msdn2.microsoft.com/en-us/library/11bxex12.aspx
•
•
Join Date: Oct 2006
Posts: 3
Reputation:
Solved Threads: 1
I think what you may be referring to is actually called "Me". "Me", like "this" in C++, is a reference to the object for which you are creating code. You are placing code in a form object, so "Me" is a reference to that form. Forms contain methods and procedures which can be accessed by Me.methodName() or Me.propertyName. This is redundant, however, because "Me" is assumed. Furthermore, "Computer" is not one of the properties or methods contained in a Form. If you are just starting out, I'd suggest finding a tutorial web site or buy a book.
![]() |
Similar Threads
- google "keyword" question (Search Engine Optimization)
- Can't remove "about:blank" homepage. Please help. (Viruses, Spyware and other Nasties)
- "The page cannot Be Displayed". (Web Browsers)
- "WINDOWS\ SYSTEM\ BRIDGE.DLL" (Viruses, Spyware and other Nasties)
- I need special stuff in my project like system("cls") (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: String To Array
- Next Thread: SQL Biblio.mdb database
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





