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

Open a Form

I'm a vb programmer but i have to touch C# a bit now. I'm looking for
a thing that doesn't seems to exist anywhere here im talking of how to
open a form.

in vb it was just frmMyform.show or frmMyform.load and after showing
it.
Ive search the web for that and it always came out with like 2 to 5 of
code lines that's completely stupid

i have tred all them and they all create a brand new form that doesnt
even exist and never manage to open my form. It seems that everyone is
building their form at runtime.

here's the one that i was thinking it would have work but no

frm frmResults = new frm();
frmResults.show();

i tried also instead of show : .ShowDialog(); i even try load even it
wasnt in event list.

Sep 5 '07 #1
4 1417
Franck wrote:
I'm a vb programmer but i have to touch C# a bit now. I'm looking for
a thing that doesn't seems to exist anywhere here im talking of how to
open a form.

in vb it was just frmMyform.show or frmMyform.load and after showing
it.
And in VB, how did you initialize the variable "frmMyform"?
Ive search the web for that and it always came out with like 2 to 5 of
code lines that's completely stupid

i have tred all them and they all create a brand new form that doesnt
even exist and never manage to open my form. It seems that everyone is
building their form at runtime.
Even in VB, your form doesn't exist until runtime. How could it?

VB may be hiding the instantiation of the Form-derived class from you.
It may put the reference to the instantiated class in a global variable
for you. But rest assured, there's no form until you run your program.
here's the one that i was thinking it would have work but no

frm frmResults = new frm();
frmResults.show();
This is the usual way to instantiate _and_ show a form.

You are not very clear on what about the above code doesn't work for
you. But if you want to simply show a previously hidden (but not closed
or disposed) instance of a form, the simple answer is that you need a
reference to that form somewhere.

How you do this is up to you. There have been a number of threads on
this very concept in this newsgroup, so Google Groups should be able to
help you out there.

If you are having a problem other than simply obtaining the reference to
a form instance that already exists, then it would help for you to ask
your question in a more specific way. A concise-but-complete example of
code demonstrating your problem would be helpful.

Pete
Sep 5 '07 #2
i said it.
in vb you just for example put a simple button on a form and you
double click it to get to the click event
and in it you jsut write these 2 words

frmMyform.show

thats it and bang your form in your project named frmMyform open up in
front of your eyes, it not that complicated it can't be easier
if you take example of the code i put in my other message it's the one
i tought that would work best but it's 2 lines it's really long for
opening a single form. OHHH for openning a for it does open a form i
don't know where he take his frmResult there but it wasnt mine. All
other codes ive tried are creating a brand new form that popup you.

In other word, do you always code a program in 1 form or you use
multiple one ? i wish you use more than 1, so how do you pass from one
to the other.

Sep 5 '07 #3
i solved my problem i wrote the code in vb instead and it worked.
Maybe because there is small difference in the c# version of visual
studio 2005

Sep 6 '07 #4
When you say, in VB it was just frmMyForm.show, you are probably talking
about VBA or VB 6. In .net (VB and CSharp), the minimum code, I believe,
would be:

// csharp
ui = new frmMyForm();
ui.Show();

' vb
ui = New frmMyForm()
ui.Show()

If your code like above was not working, then I would suspect there was an
error in the form initialization.

"Franck" wrote:
I'm a vb programmer but i have to touch C# a bit now. I'm looking for
a thing that doesn't seems to exist anywhere here im talking of how to
open a form.

in vb it was just frmMyform.show or frmMyform.load and after showing
it.
Ive search the web for that and it always came out with like 2 to 5 of
code lines that's completely stupid

i have tred all them and they all create a brand new form that doesnt
even exist and never manage to open my form. It seems that everyone is
building their form at runtime.

here's the one that i was thinking it would have work but no

frm frmResults = new frm();
frmResults.show();

i tried also instead of show : .ShowDialog(); i even try load even it
wasnt in event list.

Sep 6 '07 #5

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

Similar topics

1
by: Konstantin | last post by:
Can someone help me figure out a way to open a form only once in an MDI app. I have an MDI app that contains several forms. I use each form depending on the type of document that the user needs...
2
by: Julia Baresch | last post by:
Hi everyone, As some of you may know, we've been having trouble with an unrecognized database format error. Today I installed an unfinished project on the workstation of one of my users. ...
1
by: petersk | last post by:
Firstly I am an older person trying to teach myself to create a project and teach myself Access VBA programming along the way. I anticipate a number of problems I will need help with but here...
14
by: Simon Abolnar | last post by:
I would like to know how to open child form from dialog form. Thanks for help! Simon
3
by: rdemyan via AccessMonster.com | last post by:
My application is split into a front end and back end. Each user has their own copy of the front end. There are a few forms I only want to be open for one user at a time. So I've implemented the...
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
10
waynetheengineer
by: waynetheengineer | last post by:
Hi, I'm trying to write code for a form when it closes. It's supposed to requery a combo box depending on which form is currenlty open in the background behind the current form, shown below: ...
19
by: =?Utf-8?B?R3JlZw==?= | last post by:
How can I tell via code if a Form is already open. Each time my forms load I have some initialization code that runs, but if the form is already open and hidden I don't want that initialization...
5
by: billa856 | last post by:
Hi, My project is in MS Access 2002. In that I want to open one form multiple times. I put one button on my main form. Now whenever I click on that button than form will be open. Now when I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.