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

Form showing then vanishing?

Hello,

I have an app that starts in sub main()

I am making a new instance of a form so it can be displayed. It compiles
fine but when
the program is run the form shows up but then a split second later closes
itself.

Why is this?

Code below:

Public Sub main()
Dim MyNewForm As New AccountsForm

MyNewForm .Show()

End Sub

Thanks,

Adam


Nov 21 '05 #1
8 1349

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
I am making a new instance of a form so it can be displayed. It compiles
fine but when
the program is run the form shows up but then a split second later closes
itself.

Why is this?

Code below:

Public Sub main()
Dim MyNewForm As New AccountsForm

MyNewForm .Show()


Replace the line above with this one:

\\\
Application.Run(MyNewForm)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Thanks,

ShowDialog() seems to work too.....

Adam

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
I am making a new instance of a form so it can be displayed. It compiles
fine but when
the program is run the form shows up but then a split second later closes
itself.

Why is this?

Code below:

Public Sub main()
Dim MyNewForm As New AccountsForm

MyNewForm .Show()


Replace the line above with this one:

\\\
Application.Run(MyNewForm)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schrieb:
ShowDialog() seems to work too.....


'ShowDialog' is semantically incorrect in this particular case.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #4
Adam,

Why you use sub main.

I have seen yesterday that Crouchie has the same idea as me about this.
(Can be that he was that much longer however I saw a message about this from
him yesterday)

AFAIK was Terry(Ohm) that already.

Cor
Nov 21 '05 #5
On 2005-04-29, Adam Honek <Ad*******@Webmaster2001.freeserve.co.uk> wrote:
Hello,

I have an app that starts in sub main()

I am making a new instance of a form so it can be displayed. It compiles
fine but when
the program is run the form shows up but then a split second later closes
itself.

Why is this?

Code below:

Public Sub main()
Dim MyNewForm As New AccountsForm

MyNewForm .Show()

End Sub

Thanks,

Adam


Change it like this:

Public Sub Main ()
Application.Run (New AccountsForm)
End Sub

--
Tom Shelton [MVP]
Nov 21 '05 #6
On 2005-04-30, Cor Ligthert <no************@planet.nl> wrote:
Adam,

Why you use sub main.

I have seen yesterday that Crouchie has the same idea as me about this.
(Can be that he was that much longer however I saw a message about this from
him yesterday)

AFAIK was Terry(Ohm) that already.

Cor


Is something wrong with using Sub Main? VB.NET trys to hide it - but, I
use it a lot for things like checking for a single instance, etc. Of
course, I do all my real programming in C# anyway...

--
Tom Shelton [MVP]
Nov 21 '05 #7
>>
I have seen yesterday that Crouchie has the same idea as me about this.
(Can be that he was that much longer however I saw a message about this
from
him yesterday)

AFAIK was Terry(Ohm) that already.

Cor


Is something wrong with using Sub Main? VB.NET trys to hide it - but, I
use it a lot for things like checking for a single instance, etc. Of
course, I do all my real programming in C# anyway...


We are active in more newsgroups, therefore I know what language you are
using at the moment.

However why use archaic sentences, if there is something nice built in.
(You would probably have seen, that I am always asking to people why, who
want to translate, what they are used to do in the past, in a newer
languages).

My standard sample is from far in past, when somebody told that Cobol was
much slower than Fortran. He had a translated Sort from his Fortran program
in the same way in Cobol.

He did not know that there was a Sort method already from the first versions
built in as feature in the Cobol language.

(We know that this is bs. the compiler on a particular OS or in that time
computer makes the performance)

In C# it is not built in (and when not using a form in VBNet as well not).
However when you use a form, than why not use that built in feature.

Just my thought,

Cor

Nov 21 '05 #8
On 2005-04-30, Cor Ligthert <no************@planet.nl> wrote:

I have seen yesterday that Crouchie has the same idea as me about this.
(Can be that he was that much longer however I saw a message about this
from
him yesterday)

AFAIK was Terry(Ohm) that already.

Cor
Is something wrong with using Sub Main? VB.NET trys to hide it - but, I
use it a lot for things like checking for a single instance, etc. Of
course, I do all my real programming in C# anyway...


We are active in more newsgroups, therefore I know what language you are
using at the moment.


I hope you understand... I still like VB.NET - I just don't have much
call to use it anymore. My employer has standardized on C#. Plus,
since I've been messing around with Linux, I find Mono a convenient
method of staying with a familar language - and right now, VB.NET
doesn't work all that well on Mono (but it's getting better).
However why use archaic sentences, if there is something nice built in.
(You would probably have seen, that I am always asking to people why, who
want to translate, what they are used to do in the past, in a newer
languages).

My standard sample is from far in past, when somebody told that Cobol was
much slower than Fortran. He had a translated Sort from his Fortran program
in the same way in Cobol.

He did not know that there was a Sort method already from the first versions
built in as feature in the Cobol language.

(We know that this is bs. the compiler on a particular OS or in that time
computer makes the performance)

In C# it is not built in (and when not using a form in VBNet as well not).
However when you use a form, than why not use that built in feature.


Well, it actually is built in to Visual C#. When you create a windows forms
project in C#, a default Main is generated by Visual Studio - it just
doesn't hide it from you the way VB.NET does. I'm not saying to always use
Main by the way, but there are times when it is useful. I think of it as
another tool in the old toolbox :)

--
Tom Shelton [MVP]
Nov 21 '05 #9

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

Similar topics

1
by: sandman | last post by:
I set the MinimumSize property on my form but it doesn't seem to work. I can still resize the form to any size I want. What I'm trying to do is prevent the buttons from vanishing when the form is...
7
by: Andrew Ducker | last post by:
My unhandled exceptions seem to just vanish. If I put the line: int x = int.Parse("XXX"); in (which generates an exception, obviously) then the code that's executing just vanishes, leaving me...
0
by: Michael | last post by:
After trying to load my java applet from <OBJECT> tag (rather than <APPLET> tag), it renders fine, except when you click between the DESIGN view then back to HTML view, the <PARAM NAME="ARCHIVE"...
2
by: Linda | last post by:
Greetings, I am experiencing a problem similar to that mentioned in <a...
7
ADezii
by: ADezii | last post by:
I am experiencing an extremely peculiar problem, which occurred immediately after converting a self-contained Access 2003 database to a Front/Back End architecture. When I enter a specific field ()...
1
ADezii
by: ADezii | last post by:
I am experiencing an extremely peculiar problem, which occurred immediately after converting a self-contained Access 2003 database to a Front/Back End architecture. When I enter a specific field ()...
2
by: reidarT | last post by:
I want a windows form to act like the one in Outlook when you get a new message and it is visible for about a couple of seconds and then the opacity decreases and the form dissapears in the end I...
2
by: mark4asp | last post by:
The first intem in a DropDownList is vanishing! My code to load a DropDownList is shown below. Yet when I load the page after a postback there is no zeroth item present. ...
36
by: TC | last post by:
I've used Access for many years. Several times, I've encountered a bug which I refer to as the "Vanishing Joins" bug. When it happens, joins vanish randomly from queries. More specifically, all...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
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.