Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   VB .Net Question (http://www.chiefdelphi.com/forums/showthread.php?t=21364)

Raven_Writer 17-07-2003 13:30

VB .Net Question
 
I've searched MSDN, Google, and Yahoo for this, asked people, but still haven't really got anything.

What I'm trying to do is figure out how to create a new line (i.e.: In C++, \n makes a new line). But can't find out how to do it.

I've also searched the help document that comes with Visual Studio .NET (the one that FIRST gave us).

If anyone knows how/if it is possible to do, please tell me.

[Edit: Also, how would you load another form?

EX: In VB6, you do
PHP Code:

*form name here*.visible true 

How do you do it in VB .NET? ]

Jnadke 17-07-2003 13:59

Search harder.

It's there.

Typically a new line consists of a line feed function and a carriage return function. Some languages have them combined.

Raven_Writer 17-07-2003 14:54

Quote:

Originally posted by Jnadke
Search harder.

It's there.

Typically a new line consists of a line feed function and a carriage return function. Some languages have them combined.

Ok, thanks. I found what I wanted:

PHP Code:

System.Environment.NewLine 


Nate Smith 17-07-2003 15:48

Re: VB .Net Question
 
Quote:

Originally posted by Raven_Writer

[Edit: Also, how would you load another form?

EX: In VB6, you do
PHP Code:

*form name here*.visible true 

How do you do it in VB .NET? ]

in .NET, it's a bit trickier. The catch to remember is that every form in VB.NET is considered an object. Now, I think all the code below is correct, but I don't have .NET on this machine right now to try it out...

PHP Code:

Dim frmShowMe as frmFormToDisplay
frmShowMe 
= New frmFormToDisplay
frmShowMe
.Show 


Raven_Writer 17-07-2003 18:16

Re: Re: VB .Net Question
 
Quote:

Originally posted by Nate Smith
in .NET, it's a bit trickier. The catch to remember is that every form in VB.NET is considered an object. Now, I think all the code below is correct, but I don't have .NET on this machine right now to try it out...

PHP Code:

Dim frmShowMe as frmFormToDisplay
frmShowMe 
= New frmFormToDisplay
frmShowMe
.Show 


Actually, you are almost correct.

It's
PHP Code:

Dim frmholder as new frmtodisplay
frmholder
.activate()
frmholder.visible true 

There's only 1 problem w/ this, if you close out of it, and try to show the frm again, it crashes.

seanwitte 18-07-2003 09:27

If you want to open a form named frmSetup:

Form setupForm = new frmSetup();
frmSetup.Visible = true;
frmSetup.Activate();

if you want to open it as a modal dialog:

Form setupForm = new frmSetup();
frmSetup.ShowDialog();

The only issue with the first method is that unless you check to see if the form is already open, you'll have multiple instance of the same form floating around. The difference between the Show() and Activate() methods is that Show() just makes it visible, but Activate() brings it to the front. Activate() only works if the form is visible, so you need to set the Visible property first.

Raven_Writer 18-07-2003 10:26

Quote:

Originally posted by seanwitte
If you want to open a form named frmSetup:

Form setupForm = new frmSetup();
frmSetup.Visible = true;
frmSetup.Activate();

if you want to open it as a modal dialog:

Form setupForm = new frmSetup();
frmSetup.ShowDialog();

The only issue with the first method is that unless you check to see if the form is already open, you'll have multiple instance of the same form floating around. The difference between the Show() and Activate() methods is that Show() just makes it visible, but Activate() brings it to the front. Activate() only works if the form is visible, so you need to set the Visible property first.

Welp, that explains the crashing. Thanks seanwitte. Is opening it as a modal dialog better than using the activate() one?

[EDIT: Using the ShowDialog() doesn't cause a crash in the program (hurray!).]

seanwitte 18-07-2003 10:45

A modal dialog will keep the focus until you close it. If FormA opens FormB as a dialog, then you can only interact with FormB until you close that form. For most cases its probably fine, normally you'd use it when you need input before doing something else. You are forcing the user to commit or cancel some operation before they can continue.

If you need two forms open at the same time with the user jumping between them then you need to use Activate() or Show(). The Show() method is the equivalent of setting the Visible property to True BTW.

Raven_Writer 19-07-2003 13:36

Ok, my program (more specific, a dash-board program) is coming along nice. I have yet another question though. Is it possible to have 2 forms show up, and dock the 2nd one to the first (like what AIM can do with the edge of the screen).

I've got this:
PHP Code:

switch.dock dockstyle.right 

(switch is already defined). It shows and everything, but I want it to be visible (not behind the main form) when the program starts (for a more clear example, look at roboEmu (http://www.robbayer.com/software.html) program to see what I mean).

rbayer 19-07-2003 22:32

Quote:

Originally posted by Raven_Writer
Ok, my program (more specific, a dash-board program) is coming along nice. I have yet another question though. Is it possible to have 2 forms show up, and dock the 2nd one to the first (like what AIM can do with the edge of the screen).

I've got this:
PHP Code:

switch.dock dockstyle.right 

(switch is already defined). It shows and everything, but I want it to be visible (not behind the main form) when the program starts (for a more clear example, look at roboEmu (http://www.robbayer.com/software.html) program to see what I mean).

A few things to start off with:
1. Traditional docking involves docking one window inside another.
2. Docking to the edge of the screen (AIM style) and docking one window to another (a-la Winamp) are two very different things.
3. RoboEmu doesn't actually use docking. I just tell it to put the Windows in the right place to start. It's up to the user to keep them that way. :)

Anyways, I don't really know much VB, but from what I've been able to discern, getting a window to dock to the outside of another one is not an easy task. A quick google search turned up this: http://www.visualbasicforum.com/t54802.html

Raven_Writer 20-07-2003 10:32

Quote:

Originally posted by rbayer
A few things to start off with:
1. Traditional docking involves docking one window inside another.
2. Docking to the edge of the screen (AIM style) and docking one window to another (a-la Winamp) are two very different things.
3. RoboEmu doesn't actually use docking. I just tell it to put the Windows in the right place to start. It's up to the user to keep them that way. :)

Anyways, I don't really know much VB, but from what I've been able to discern, getting a window to dock to the outside of another one is not an easy task. A quick google search turned up this: http://www.visualbasicforum.com/t54802.html

Thank you rbayer, I didn't know there was a difference (much) between Winamp-style and AIM-style.

And sorry about he RoboEmu thing....I thought you docked the windows.


All times are GMT -5. The time now is 20:15.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi