Click here to Skip to main content
15,895,084 members

Problem with ShowDialog() method in C#.

JayantaChatterjee asked:

Open original thread
I want to call a form to another form, but I want the calling form shows like dialog box(not resizing). I passing parameter to my new_customer form's constructor.
so My code is :-
new_customer NC = new new_customer(null);
            NC.ShowDialog();


My new_customer form constructor :-

C#
public new_customer(string formType="save")
       {
           InitializeComponent();
           DC = new Data_Conn(Application.StartupPath);
           DC1 = new Data_Conn(Application.StartupPath);
           paraModi = formType;
       }

Problem is when I call new_customer form from another form, its constructor doesn't execute,that's why I get an error when I use that variable :
Object reference not set to an instance of an object.


thanks In advanced ..
Tags: C#, Windows Forms

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900