Is it some one hwo know how to open a form. I want to show form2 when some one presses button1?

u means open a filr dialog? for example,a dialog to let ppl load the file location?

file dialog*

No, i have like a "form - winform, window" that i have created in c#. In the first window that opens i have a button, if you click the button, then "this.hide" and i want to open the other winform-window.

Form2 frm2 = new Form2();
this.Hide();
frm2.Show();
Form2 frm2 = new Form2();
this.Hide();
if (frm2.ShowDialog() == DialogResult.Cancel)
return;
/* here you can return values from form2 back to form1 if Form2 DialogResult is DialogResult.Ok but make sure that your accept button's Dialog Result is set to DialogResult.Ok or force dialogresult.OK if certain conditions are meet by this.DialogResult = DialogResult.OK
 I know this goes more past the question but if not answered now will be a question in the future hope this was helpful.*/
this.Show();

Thanks, it workd :D

Thanks, it workd :D

glad i could help

Btw. is it posible to open class. I have made a class in a winform project. If button3 click then i want to show my class. Class name in Class1. how do i do that ?

What do you mean by 'show a class'? A class is a collection of methods and properties. What about it do you want to show?

I have made a class, in the class i have made this code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Eoop_Desktop
{
    class Class1
    {
        static void main(string[] args)
        {
            Console.WriteLine("hello");
            Console.ReadKey();
        }
        
    }
}

I want to open the class if someone press the button3.... ?
When someone opens the class, they will see a cind of cmd windows... inside my application. I need the code for button3.

No a class is not a visual Control... by adding : Form after class name makes it a form , : UserControl Makes it a usercontrol but a class by itself as Maven has said it is a collection of Methods and Propertys.

Do you know how i can run this code then ? in an other way :L

So you want to open a console window after clicking a button in a forms application?

Yes, how ?

Process.Start("cmd.exe");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.