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

Loading an invisible form

Dan
How does one load a hidden form in VB.NET? There doesn't seem to be a design
time "visible" property any more?
Nov 23 '05 #1
10 8468
CT
You can use the Hide and Show methods of the Form class.

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
How does one load a hidden form in VB.NET? There doesn't seem to be a
design
time "visible" property any more?

Nov 23 '05 #2
Dan
I just tried that, and got an "Error creating window handle" exception on the
SendMessage call when running the following code:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal
lParam As Integer) As Integer

Dim testform As New Form2
testform.Hide()
SendMessage(testform.Handle.ToInt32, &H8000, 0, 0)

Anybody know what's going on?

"CT" wrote:
You can use the Hide and Show methods of the Form class.

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
How does one load a hidden form in VB.NET? There doesn't seem to be a
design
time "visible" property any more?


Nov 23 '05 #3
CT
Dan,

You can change the API Declare to this:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal
lParam As Integer) As Integer

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
I just tried that, and got an "Error creating window handle" exception on
the
SendMessage call when running the following code:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer,
ByVal
lParam As Integer) As Integer

Dim testform As New Form2
testform.Hide()
SendMessage(testform.Handle.ToInt32, &H8000, 0, 0)

Anybody know what's going on?

"CT" wrote:
You can use the Hide and Show methods of the Form class.

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work
but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
> How does one load a hidden form in VB.NET? There doesn't seem to be a
> design
> time "visible" property any more?


Nov 23 '05 #4
Dan
Carsten,

I did that, but it didn't fix the problem.

Dan
"CT" wrote:
Dan,

You can change the API Declare to this:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal
lParam As Integer) As Integer

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
I just tried that, and got an "Error creating window handle" exception on
the
SendMessage call when running the following code:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer,
ByVal
lParam As Integer) As Integer

Dim testform As New Form2
testform.Hide()
SendMessage(testform.Handle.ToInt32, &H8000, 0, 0)

Anybody know what's going on?

"CT" wrote:
You can use the Hide and Show methods of the Form class.

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work
but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
> How does one load a hidden form in VB.NET? There doesn't seem to be a
> design
> time "visible" property any more?


Nov 23 '05 #5
CT
Okay, I'm not sure what message it is you're sending, but if you use the
suggested SendMessage Declare, and this call, do you still experience the
problem?

SendMessage(testform.Handle, &H8000, 0, 0)
--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:EE**********************************@microsof t.com...
Carsten,

I did that, but it didn't fix the problem.

Dan
"CT" wrote:
Dan,

You can change the API Declare to this:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer,
ByVal
lParam As Integer) As Integer

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work
but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
>I just tried that, and got an "Error creating window handle" exception
>on
>the
> SendMessage call when running the following code:
>
> Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
> (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer,
> ByVal
> lParam As Integer) As Integer
>
> Dim testform As New Form2
> testform.Hide()
> SendMessage(testform.Handle.ToInt32, &H8000, 0, 0)
>
> Anybody know what's going on?
>
> "CT" wrote:
>
>> You can use the Hide and Show methods of the Form class.
>>
>> --
>> Carsten Thomsen
>> Communities - http://community.integratedsolutions.dk
>> ---------
>> Voodoo Programming: Things programmers do that they know shouldn't
>> work
>> but
>> they try anyway, and which sometimes actually work, such as
>> recompiling
>> everything. (Karl Lehenbauer)
>> ---------
>> "Dan" <Da*@discussions.microsoft.com> wrote in message
>> news:8C**********************************@microsof t.com...
>> > How does one load a hidden form in VB.NET? There doesn't seem to be
>> > a
>> > design
>> > time "visible" property any more?
>>
>>
>>


Nov 23 '05 #6
What are trying to do? Perhaps there is an alternate way to do what
you want to do?

Nov 23 '05 #7
Dan
Chris-- I am trying to subclass an invisible windows form by overriding its
WndProc method so that I can send custom messages to it from another process.

Carsten--I did exactly what you recommended with no luck

....Dan

"Chris Dunaway" wrote:
What are trying to do? Perhaps there is an alternate way to do what
you want to do?

Nov 23 '05 #8
> How does one load a hidden form in VB.NET? There doesn't seem to be a design
time "visible" property any more?


At the top of the form's Load event, call Hide.

Nov 23 '05 #9
Dan
I figured out the problem. When I overrode the WndProc method in my form, I
forgot to pass along the messages via MyBase.WndProc(msg) before existing my
override.

Also, it seems that I can create the window without showing by simply
creating a new instance of the form without showing it.

Thanks very much for your help.

Dan

"CT" wrote:
Okay, I'm not sure what message it is you're sending, but if you use the
suggested SendMessage Declare, and this call, do you still experience the
problem?

SendMessage(testform.Handle, &H8000, 0, 0)
--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:EE**********************************@microsof t.com...
Carsten,

I did that, but it didn't fix the problem.

Dan
"CT" wrote:
Dan,

You can change the API Declare to this:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer,
ByVal
lParam As Integer) As Integer

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work
but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
>I just tried that, and got an "Error creating window handle" exception
>on
>the
> SendMessage call when running the following code:
>
> Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
> (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer,
> ByVal
> lParam As Integer) As Integer
>
> Dim testform As New Form2
> testform.Hide()
> SendMessage(testform.Handle.ToInt32, &H8000, 0, 0)
>
> Anybody know what's going on?
>
> "CT" wrote:
>
>> You can use the Hide and Show methods of the Form class.
>>
>> --
>> Carsten Thomsen
>> Communities - http://community.integratedsolutions.dk
>> ---------
>> Voodoo Programming: Things programmers do that they know shouldn't
>> work
>> but
>> they try anyway, and which sometimes actually work, such as
>> recompiling
>> everything. (Karl Lehenbauer)
>> ---------
>> "Dan" <Da*@discussions.microsoft.com> wrote in message
>> news:8C**********************************@microsof t.com...
>> > How does one load a hidden form in VB.NET? There doesn't seem to be
>> > a
>> > design
>> > time "visible" property any more?
>>
>>
>>


Nov 23 '05 #10
"Dan" <Da*@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
How does one load a hidden form in VB.NET?


You create an instance of the Form's class and use it like any other
class. It's only when you call the [Form] object's Show method
that anyone gets to see it.

HTH,
Phill W.
Nov 23 '05 #11

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

Similar topics

4
by: Matthew | last post by:
I am not the most talented programmer to grace the earth by a long shot. But I've got a gripe I need to air about the .NET implementaion of Visual Basic. I can live with alot of the major changes...
6
by: Curious George | last post by:
I have a page that takes about 10 seconds to load the first time it is run. I would like to first display a little animated gif telling the user that the page is loading. How do I do this with...
3
by: Jose_Csharp | last post by:
Hi guys, I´m trying to make a startup invisible form. I don´t want a form with Opacity property 0. First I did the property Visible of the form to false. It wasn´t a good idea, was too easy. Then...
6
by: Mr. Analogy | last post by:
I'd like to load a form in the background (invisibly) and then, afer the controls are all drawn (and resized, in this case), I'd like to show it. I.e., I want the form to show up nice and crisply,...
3
by: Eric A. Johnson | last post by:
In a new project I'm creating, I have my first form that loads being used as a splash screen, with a timer that activates after 5 seconds. I then want the main form to load. However, it isn't...
2
by: adiel_g | last post by:
I added a user control to a webform in Asp.net 2.0. I am also adding several other user controls to this webform. Now I am trying to find a way to stop the user controls from loading up when I...
6
by: A.Weinman | last post by:
Hello all, I have an application that has multiple forms, only 3 of which matter for this issue. There is a main form that starts invisible and does nothing more than start other forms and link...
0
by: Rinoa | last post by:
I'm developing a program with a login form. I want the login in form to be the first form that loads, and I want it to close itself when the main CP loads. However, when I set frmLogIn as the startup...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi all, misters I have a WinForms that contains a Panel. I want to add controls dynamically to the panel. My code is similar like this:
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.