|
I am trying to get reference to a control from my own app. If GetObject won't work what else I can do?
Thanks in advance
Regards Ganesh
PULSARS
|
|
|
|
|
is this vb6? if so and assuming your asking for this within the same project, the only way to associate a string to an object is go through the collections.
first start with the forms collection then go through the control collection
dim oFrm as Form,oCtrl as control
For each oFrm in Forms
If oFrm.Name = "mnuMain" Then
For each oCtrl In oFrm.controls
If oCtrl.Name = "mnuExit" Then
oCtrl.enabled=true
oCtrl.visible = true
Exit For
End If
Next
Exit For
End if
Next
|
|
|
|
|
Thanks for the reply. I am using VB.NET 2005
I have a control called mnuExit in MenuStrip1 in FrmMain. When I try to iterate through the controls collection in FrmMain I only get reference to MenuStrip1 and not to the control mnuExit. However, when I work with the form in IDE I get reference to FrmMain.mnuExit. Is there a way to get reference to FrmMain.mnuExit through direct iteration?
Thanks in advance
Regards Ganesh
PULSARS
|
|
|
|
|
You have to enumerate the children of controls too, nut just the controls in the Form's Controls collection.
This would probably be best done with a recursive solution. If a control has children, the function calls itself with the current control.
|
|
|
|
|
I'll try that.
Thanks for your time
Regards Ganesh
PULSARS
|
|
|
|
|
Hello All,
Iam using Webbrowser control in VB6. I need to prevent 'F5' Key and also "Right-Click" menu in Webbrowser control.
And While print the html content in Webbrowser control using VB6.
I need to print the html content without Header and Footer of Webbrowser control.
Please give me some ideas...
Thanks & Regards
Kumaran
|
|
|
|
|
For the 'F5' part...turn on keypreview of the form and trap it in the keydown event of the form and if 'F5' then ignore the key.
Not sure about the mouse...
|
|
|
|
|
i want to connect ADO datacontrol, when i try to select the Server it gives me an error message
("Error enumarating data servers" enumarator data reports" unspecified error)
Vuyiswa
|
|
|
|
|
You can Google for "error enumerating data servers"[^] (with the quote marks!) to start trouble shooting the problem. There's a bunch of possible causes, dependant on the database server you're trying to use and what's installed on your machine.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Am redesigning the application that was written by other programmer who left the company.there is no documentation. am just looking at his and redisigning the application. the application has datagrid, i have change from Ms Access to Microsoft sql, when i run my new application checking on the datagrid result, this is what i get.
"Subscript out of range" and mark this Column yellow"
datagrid1.Columns(3).Width = 1820.
what would be the cause ?
and what should i have in mind while editing the datasource from access to Sql?
Vuyiswa
|
|
|
|
|
You are trying to access a column that doesn't exist. The data source returns less than four columns.
---
single minded; short sighted; long gone;
|
|
|
|
|
how many columns you have, i think you have only three columns then the subscript for last column is 2. just change 3 to 2 and it will work fine.
Vilsad P P
MCTS (Windows Applications) .Net 2.0
|
|
|
|
|
Perhaps you should reply to the original poster instead of to me.
---
single minded; short sighted; long gone;
|
|
|
|
|
please help me ASAP!
Actually i want read a line from 1st text file and search this line in the second text file( which had the string as in 1st txt file and equivalent localized string) and then copy this localized string from 2nd text file and replace with the 1st one.
Thanks in advance!
pankaj kumar
|
|
|
|
|
pankajs3k wrote: please help me ASAP!
I already did....
pankajs3k wrote: Actually i want read a line from 1st text file and search this line in the second text file( which had the string as in 1st txt file and equivalent localized string) and then copy this localized string from 2nd text file and replace with the 1st one.
I repeat - to do this, you need to read the second file into memory, then you can replace parts of it in memory, and overwrite the old file with the new one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have this code to validate characters and numbers in textbox, i have wrote it in vb 6 now "KeyAscii" is not recognised, tells me that the variable not declared. in vb6 its good help me write the two code in .net
'Accept only Characters refer to code Project
' If KeyAscii < Asc("9") Then
' KeyAscii = 0
'End If
'Accept numbers only refer to code project for Documentation
' If KeyAscii > Asc("9") Then
'KeyAscii = 0
' end if
thanks
Vuyiswa
|
|
|
|
|
Use the KeyChar property of the event argument object that is sent to the event.
---
single minded; short sighted; long gone;
|
|
|
|
|
still give me an Error
Private Sub txtmobile_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtmobile.TextChanged
'Accept numbers only refer to code project for Documentation
If KeyChar > Asc("9") Then
KeyChar = 0
End If
End Sub
Vuyiswa
|
|
|
|
|
I strongly urge you to turn off your computer, go to a bookstore, buy a book on VB.NET, a beginner book that teaches you to code, and not just to play with the shiny wizards. Read it.
You have not taken the advice you were given. The text changed event doesn't just recieve an EventArgs object, it recieves a derived object called somthing like a TextEventArgs, which has a property called KeyChar. You're trying to pull a mythical property out of thin air instead of doing waht you were told.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The event object in your handler is called "e". You have to do something like this:
If e.KeyCode = Keys.whatever ...
You also cannot do this in the TextChanged event of the TextBox. It doesn't give you th ekey that was hit. You have to use the KeyDown event.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
His e is also still an eventargs object, not a derived one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
tHANK YOU MAN YOU ARE A MAN
Vuyiswa
|
|
|
|
|
The TextChanged event isn't used to handle a key press, so you can not use it to cancel a key. When the TextChanged event is executed, the contents of the text box has already changed.
Use the KeyPress event to handle key presses.
KeyChar is not a global variable, it's a property of the KeyPressEventArgs object. Also, it's not an ASCII code, it's a char.
You would do better to look up the documentation about what you are doing, instead of just guessing.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi there,
Is suppose there is a way to select or set a different tray on a printer when printing from visual basic 6? How do i do that?
Thank for your time.
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
Hi there,
Thanks for your time. I've figure it out. It's easy, use the PaperBin property of the Printer Class to specify the tray to use.
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|