form top most when ran from sub main

B

Brian

Ok.. starting to tick me off now...
simple.. works when I just start the app from a form.. but when I choose to
start from a sub main..
I can not get the form to stay top most... even thought the top most
properitry is true...
any ideas?
 
A

Armin Zingler

Brian said:
Ok.. starting to tick me off now...
simple.. works when I just start the app from a form.. but when I
choose to start from a sub main..
I can not get the form to stay top most... even thought the top most
properitry is true...
any ideas?

Tried it and it works:

Shared Sub main()
Dim f As New Form1
f.TopMost = True
Application.Run(f)
End Sub

What's you code?


Armin
 
B

Brian

ok.. went back and checked it...
actually set my form to be the startup object... and for some reason..
topmost on the form does not work... ..
I've enabled application framework and still nothing...
 
M

Michael Williams

ok.. went back and checked it...
actually set my form to be the startup object... and for some reason..
topmost on the form does not work... ..
I've enabled application framework and still nothing...

The problem with VB.Net is that it is designed specifically for beginners
and for casual programmers and it takes you so far away from the machine,
and so far away from the operating system, that when you come up against a
problem with it you are totally stuck unless you have knowledge of a real
programming langauge, or even a different beginners' programming language
that does not distance you so far from the machine. Have a look at the
various API functions.

Mike
 
B

Brian

Mike... your so full of it.... VB.net does have somethings that not idea or
have been missed versa c++ or C#, but for the most part just as powerful.
and the idea behind the "DotNet" was to not have to do things in the API
world. So, if you don't have something constructive to post... just don't
post...
 
B

Brian

Armin,
I have done that... and it still didn't work...
just to make sure.. I added a form... form2 with nothing on it.... called
this from my sub main().... and it worked correctly....
went back to form1 and made sure nothing was running on form_load event and
still have the same problem.
I've gone through the form.designer.vb and tried to find something there
and could not....
Any other suggestions..
 
M

Michael Williams

Mike... your so full of it....

Thank you.
VB.net does have somethings that not idea or have
been missed versa c++ or C#, but for the most part
just as powerful.

If you get time later then perhaps you might like to find someone who can
translate that into English for you. If you do then post again.
and the idea behind the "DotNet" was to not have to
do things in the API world.

Yes. VB.Net is for beginners and for first time or casual Windows
programmers. Check it out here:

http://www.microsoft.com/express/product/default.aspx

Mike
 
A

Armin Zingler

Brian said:
Armin,
I have done that... and it still didn't work...
just to make sure.. I added a form... form2 with nothing on it....
called this from my sub main().... and it worked correctly....
went back to form1 and made sure nothing was running on form_load
event and still have the same problem.
I've gone through the form.designer.vb and tried to find something
there and could not....
Any other suggestions..

I'm afraid, not from me currently.

What do you expect from topmost? If there are other topmost-windows, they
are handled equally, that means, they have their own z-order. Maybe yours is
covered by another topmost window? (though I don't think it is)


Armin
 
C

Cor Ligthert[MVP]

I have missed that one from Herfried and you for years

No critique it reminds me always too a message from Jay who showed once 12
possibilities to run a VB program

Are you still using that one?

Cor
 
C

Cor Ligthert[MVP]

Is it not great, it is like a Ford T it was so easy to handle, that
everybody was changing from horse carts to automobiles

Ford is even still the strongest American brand

But don't worry, you can go on with your horse cart

Cor
 
M

Michael Williams

Is it not great, it is like a Ford T it was so easy to handle,
that everybody was changing from horse carts to automobiles
Ford is even still the strongest American brand. But don't
worry, you can go on with your horse cart

Are you still having those wet dreams about Micro$oft, Cor? It certainly
looked as though you are judging by the stupid grin on your funny upside
down face:

https://mvp.support.microsoft.com/communities/mvp.aspx?name=cor+ligthert

I always find it really amazing what people like you will sink to doing for
a few MVP trinkets.

Mike
 
B

Brian

Hello Armin...
this is what I have found so far... I have it working now.... but seems
strange i had to do this...
in my form class I had two database connections being delcared....
dim objDB1 as MycnDB1 = New SQLDB
dim objDB2 as MycnDB2 = New ORADB

these would create the object and in those classes the only thing i was
doing at the time is creating a connection to the database.
I removed these and put them in a button control.

Not sure why, by removing these from being accessable to the form1 class I
was able to put form as topmost. Now.. On my button control.. I have all
the code there.
Thanks for your help though....
Maybe someone with a detailed knowledge of DOTNET would be able to explain
this?
Brian
 
A

Armin Zingler

I've no clue what happend. Is it possible that you wrote your own Sub New in
the Form without calling InitializeComponent? In VB 2008, whenever I enter
"Sub New<enter>" the automatically generated sub already includes a call to
InitializeComponent. Or you've added an overloaded constructor without
calling MyClass.New?


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top