|
[VB6]
Anybody know of a way to create a new instance of a form if you only know the name of the form?
Right now i'm doing a huge hack... a big select case statement.
there has to be a better way!?!?!
|
|
|
|
|
Could you give us a better idea of what you are doing exactly. There are ways to create new forms programmatically.
Nick Parker
|
|
|
|
|
aight, here's the deal...
on the left, I have a treeview that holds a bunch of nodes which represent forms to open. They hold the name of the form as a string as their key.
when somebody clicks on a node, it should open a new instance of the form, by name.
If there is a better overall way to do the same effect, that'd be fine as well.
The basic gist of what I want is a list of the form's which can be shown, and to make a new one when the user clicks on it. It is possible to open more than one of the same form at a time.
|
|
|
|
|
Dim myForm as Form<br />
Set myForm = new Forms("MyFormName")
I've seen something similar to that, but I don't have VB 6 installed so I can't check it.
Should give you a start anyway,
James
Simplicity Rules!
|
|
|
|
|
hrm
the Forms collection only shows forms which are already loaded. besides, I don't think I'd be able to create a _new instance_ with this method.
also, the New Forms("MyFormName") syntax doesn't compile.
I even tried a CallByName hack ( Set myForm = CallByName( App, "MyFormName", vbGet ) ), but that didn't work either.
any other ideas?
|
|
|
|
|
Hello !!
How can I operate a MP3 file from VB program.
I know to operate a wav files. Is it the same way??
Thank you !!!
Ahuva
|
|
|
|
|
Add a Media Player component, it`s pretty easy
|
|
|
|
|
If you want to use winamp instead, check out http://winamp.com/nsdn/
|
|
|
|
|
My problem is both simple and complex...
I am writing an RS232 protocol layer that was meant for Visual C++, however now the boss man wants me to integrate it in to Visual Basic. So I decided to convert the static library to a DLL. Everything seems to work fine, and from the outside the IDE all the visual basic apps run well. However inside the IDE, after running, the VB IDE has many problems. On my machine it only causes an application error on exit. On others, it causes application errors at random times. I thought maybe I was trashing the stack, but my DLL is not doing it. I am thinking it is the arguement passing...
These are my definitions in the DLL..
[code]
#define INCOMMSTACK_API extern "C"
INCOMMSTACK_API long WINAPI Initialize (long lHwndOwner);
INCOMMSTACK_API long WINAPI ExpediteMessageByte (LPBYTE pbMsg, DWORD cBytes);
INCOMMSTACK_API long WINAPI ExpediteMessageText (LPCTSTR szMsg, DWORD cChars);
INCOMMSTACK_API long WINAPI SendMessageByte (LPBYTE pbMsg, DWORD cBytes);
INCOMMSTACK_API long WINAPI SendMessageText (LPCTSTR szMsg, DWORD cChars);
INCOMMSTACK_API long WINAPI SetRetryCount (DWORD dwRetryCount);
INCOMMSTACK_API long WINAPI SetTimeout (DWORD dwTimeout);
INCOMMSTACK_API long WINAPI SetProtocol (DWORD dwProtocol);
INCOMMSTACK_API long WINAPI ConnectRS232 (int iCommPort, int iBaudRate);
INCOMMSTACK_API long WINAPI ConnectUDP (LPCTSTR szAddress, int iPort);
INCOMMSTACK_API long WINAPI CloseConnection ();
INCOMMSTACK_API long WINAPI GetReceivedMessage (LPBYTE pbByte,
DWORD cBytes,
DWORD wParam,
long lParam);
[/code]
and these are the declaration in VB...
[code]
Private Declare Function CreateWindowEx _
Lib "user32" Alias "CreateWindowExA" _
(ByVal dwExStyle As Long, _
ByVal lpClassName As String, _
ByVal lpWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidht As Long, _
ByVal nHeight As Long, _
ByVal hWndParent As Long, _
ByVal hMenu As Long, _
ByVal hInstance As Long, _
lpParam As Any) As Long
Public Const GWL_WNDPROC = (-4)
Public Declare Function SetWindowLongApi _
Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc _
Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, _
ByVal msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function V4Initialize _
Lib "incommstack.dll" Alias "Initialize" _
(ByVal hwndOwner As Long) As Long
Private Declare Function V4ExpediteMessageByte _
Lib "incommstack.dll" Alias "ExpediteMessageByte" _
(ByRef pbByte As Byte, ByVal cBytes As Long) As Long
Private Declare Function V4ExpediteMessageText _
Lib "incommstack.dll" Alias "ExpediteMessageText" _
(ByVal szMsg As String, ByVal cChars As Long) As Long
Private Declare Function V4SendMessageByte _
Lib "incommstack.dll" Alias "SendMessageByte" _
(ByRef pbMsg As Byte, ByVal cBytes As Long) As Long
Private Declare Function V4SendMessageText _
Lib "incommstack.dll" Alias "SendMessageText" _
(ByVal szMsg As String, ByVal cChars As Long) As Long
Private Declare Function V4SetRetryCount _
Lib "incommstack.dll" Alias "SetRetryCount" _
(ByVal lRetryCount As Long) As Long
Private Declare Function V4SetTimeout _
Lib "incommstack.dll" Alias "SetTimeout" _
(ByVal lTimeout As Long) As Long
Private Declare Function V4SetProtocol _
Lib "incommstack.dll" Alias "SetProtocol" _
(ByVal lProtocol As Long) As Long
Private Declare Function V4ConnectRS232 _
Lib "incommstack.dll" Alias "ConnectRS232" _
(ByVal iCommport As Long, ByVal iBaudRate As Long) As Long
Private Declare Function V4ConnectUDP _
Lib "incommstack.dll" Alias "ConnectUDP" _
(ByVal szAddress As String, ByVal iPort As Long) As Long
Private Declare Function V4CloseConnection _
Lib "incommstack.dll" Alias "CloseConnection" () As Long
Public Declare Function V4GetReceivedMessage _
Lib "incommstack.dll" Alias "GetReceivedMessage" _
(lpByte As Any, ByVal cBytes As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
[/code]
I included the win32 calls for handling the WM_MESSAGES that the static library used to communicate to the frame in the VC++ implementation.
Any ideas on what might be happening or am I just wading in hot water with no raft....
Thanks,
Brian
Stop the insanity and free the mallocs. If not then memory will call a work stoppage and your computer shall begin a revolt, causing the current operating system to fail. Down with the man....
|
|
|
|
|
I need to make a form that can open up and then be able to look in your hardrive and search for a file and load it into a text box. I know this isnt hard but i have not done this before. Can someone please help me?
|
|
|
|
|
I need to make a form that can open up and then be able to look in your hardrive and search for a file and load it into a text box. I know this isnt hard but i have not done this before. Can someone please help me?
|
|
|
|
|
Hi,
I use VB6 & SQL Server. My database is saved in a server. The operating system in the server is Windows NT that supports only English Language, and my data, which I need to save, is written in Arabic. The problem is that the data saves as garbage.
Note: There is no problem with Visual C in the same database.
Thanks
|
|
|
|
|
Hi,
I've solved my problem by adding this statment "Auto Translate=False" to the "ConnectionString".
|
|
|
|
|
is it possible to run a activeX control (OCX) from a server side without the client downloading it. just like using asp and activeX dlls?
|
|
|
|
|
If you are on a local network you could use DCOM to instantiate the object on the other machine. Otherwise I would recommend turning to something like SOAP to run objects on a server over the internet.
SOAP is a protocol that allows you to communicate through the firewalls and such that are located on internet servers, by simply using XML.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hello,
How to pass arguments to application created by VB
Thanks
|
|
|
|
|
Project | Properties menu -> Make Tab -> Command Line arguements.
Good luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Maybe what you want is how to receive them: through the Command$ function
Crivo
Automated Credit Assessment
|
|
|
|
|
I think the problem may be the fact I am running visual studio.net under NT4, SP6A and not Win2000 prof. but just in case...
I build a simple form and add a project ( deployemnt project)
Set the project output to the simple project and attempt to build the solution.
The problem is I always get an error which states File access violation.
I check the path and it is to the project file. No files are Read only.
Has anyone else experienced this problem.
I get the same error if I try to build a CAB project also.
Wynn
|
|
|
|
|
Whenever I compile my VB programs on my coding system, they run fine and without problem. If I were to send an application over to a friend through E-Mail or run it on another computer through floppy disk, I get this error message that the publisher isn't authorized. The same error message when you run a java applet that you haven't downloaded online from an unknown company. Any ideas on how to fix this so that the computer recognizes my programs and doesn't ask the user if they trust me?
First Programmer: "How many bits are in a bite?"
Second Programmer: "You spelled bytes wrong."
First Programmer: *stares* "It's a joke, moron."
Second Programmer: "Joke...?"
|
|
|
|
|
Have your friend copy the executable to their harddrive, then run it through explorer. This is probably a security measure that has been built into your friends email program.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Does any body know if I can control my cooling fan on my laptop computer manually because it does not seem to work auto. when it hits the right temp. I want to test it. If I can’t do it in VB. Can I do that in another language?
|
|
|
|
|
You could try a non-virtual language like "resistor, +5V, voila!". Other than that you can only (with some motherboards) observe its behaviour, which I regard a good thing. Imagine any program that could access (stop) the CPU fan and burn another Athlon?
|
|
|
|
|
Think you
Mike Nordell wrote:
Imagine any program that could access (stop) the CPU fan and burn another Athlon?
Your right that would be bad.
|
|
|
|
|
Mike Nordell wrote:
Imagine any program that could access (stop) the CPU fan and burn another Athlon?
Some of them burn with the fan running normally
Crivo
Automated Credit Assessment
|
|
|
|