i have :
mainform
form2 had 2 textbox
class1.vb
class2.vb
how do i create form2 into class2.vb?
i couldn't do better. this is what i do.
in class2.vb
public class class2
public frm2 as form2
sub new()
MyBase.GetType()
frm2 = new form2
frm2.mdiparent !! <===== i wanted frm2 to be mdichild
end sub
Private Sub _Connection_onSeverMessage(ByVal szText As String) Handles
_Connection.onSeverMessage
DisplayMessage(frm2.text= szText.ToString)
End Sub
but i got error problem. it is comming from form2.
An unhandled exception of type 'System.NullReferenceException' occurred
in system.windows.forms.dll
Additional information: Object reference not set to an instance of an
object.
in class1.vb. i called from class2
Select Case C(1).Trim
Case "001" To "014", "251" To "272", "372" To "377",
"401", "422", "462", "468", "503"
Dim intA As Integer = CLi.IndexOf(Nick, 0)
RaiseEvent onSeverMessage(CLi.Substring(intA +
Nick.Length).ToString())
regards 6 1569
"Supra" <su*****@rogers.com> schrieb: i have : mainform form2 had 2 textbox class1.vb class2.vb how do i create form2 into class2.vb? i couldn't do better. this is what i do.
in class2.vb public class class2 public frm2 as form2
sub new() MyBase.GetType() frm2 = new form2 frm2.mdiparent !! <===== i wanted frm2 to be mdichild end sub
Private Sub _Connection_onSeverMessage(ByVal szText As String) Handles _Connection.onSeverMessage DisplayMessage(frm2.text= szText.ToString) End Sub
but i got error problem. it is comming from form2. An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of an object.
You will have to make a reference to your MDI container available to your
'Class2', for example in a method parameter or a property:
\\\
Private m_MdiParent As Form
Public Sub New(ByVal MdiParent As Form)
m_MdiParent = MdiParent
End Sub
Public Sub ConnectionServerMessage(...) Handles...
Dim f As New Form2()
f.MdiParent = m_MdiParent
f.Show()
End Sub
///
Usage (in MDI container):
\\\
Dim c As New Class2(Me)
....
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
i
to herfried:
how will i do in class1 from class 2
Select Case C(1).Trim
Case "001" To "014", "251" To "272", "372" To "377",
"401", "422", "462", "468", "503"
Dim intA As Integer = CLi.IndexOf(Nick, 0)
RaiseEvent onSeverMessage(CLi.Substring(intA +
Nick.Length).ToString()) <===this data would not dispaly
regards,
Herfried K. Wagner [MVP] wrote: "Supra" <su*****@rogers.com> schrieb:
i have : mainform form2 had 2 textbox class1.vb class2.vb how do i create form2 into class2.vb? i couldn't do better. this is what i do.
in class2.vb public class class2 public frm2 as form2
sub new() MyBase.GetType() frm2 = new form2 frm2.mdiparent !! <===== i wanted frm2 to be mdichild end sub
Private Sub _Connection_onSeverMessage(ByVal szText As String) Handles _Connection.onSeverMessage DisplayMessage(frm2.text= szText.ToString) End Sub
but i got error problem. it is comming from form2. An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of an object.
You will have to make a reference to your MDI container available to your 'Class2', for example in a method parameter or a property:
\\\ Private m_MdiParent As Form
Public Sub New(ByVal MdiParent As Form) m_MdiParent = MdiParent End Sub
Public Sub ConnectionServerMessage(...) Handles... Dim f As New Form2() f.MdiParent = m_MdiParent f.Show() End Sub ///
Usage (in MDI container):
\\\ Dim c As New Class2(Me) ... ///
if i added this...the datas will blanked
Public Sub ConnectionServerMessage(...) Handles...
Dim f As New Form2() <=== added
f.MdiParent = m_MdiParent<===added
DisplayMessage(nStatus.rtbStatus, szText.ToString)
' f.Show()<= rem this
End Sub
regards
Supra wrote: i to herfried: how will i do in class1 from class 2 Select Case C(1).Trim Case "001" To "014", "251" To "272", "372" To "377", "401", "422", "462", "468", "503" Dim intA As Integer = CLi.IndexOf(Nick, 0) RaiseEvent onSeverMessage(CLi.Substring(intA + Nick.Length).ToString()) <===this data would not dispaly
regards,
Herfried K. Wagner [MVP] wrote:
"Supra" <su*****@rogers.com> schrieb:
i have : mainform form2 had 2 textbox class1.vb class2.vb how do i create form2 into class2.vb? i couldn't do better. this is what i do.
in class2.vb public class class2 public frm2 as form2
sub new() MyBase.GetType() frm2 = new form2 frm2.mdiparent !! <===== i wanted frm2 to be mdichild end sub
Private Sub _Connection_onSeverMessage(ByVal szText As String) Handles _Connection.onSeverMessage DisplayMessage(frm2.text= szText.ToString) End Sub
but i got error problem. it is comming from form2. An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of an object.
You will have to make a reference to your MDI container available to your 'Class2', for example in a method parameter or a property:
\\\ Private m_MdiParent As Form
Public Sub New(ByVal MdiParent As Form) m_MdiParent = MdiParent End Sub
Public Sub ConnectionServerMessage(...) Handles... Dim f As New Form2() f.MdiParent = m_MdiParent f.Show() End Sub ///
Usage (in MDI container):
\\\ Dim c As New Class2(Me) ... ///
i don't needed to used this:
Dim c As New Class2(Me)
regards
Supra wrote: if i added this...the datas will blanked
Public Sub ConnectionServerMessage(...) Handles... Dim f As New Form2() <=== added f.MdiParent = m_MdiParent<===added DisplayMessage(nStatus.rtbStatus, szText.ToString) ' f.Show()<= rem this End Sub
regards
Supra wrote:
i to herfried: how will i do in class1 from class 2 Select Case C(1).Trim Case "001" To "014", "251" To "272", "372" To "377", "401", "422", "462", "468", "503" Dim intA As Integer = CLi.IndexOf(Nick, 0) RaiseEvent onSeverMessage(CLi.Substring(intA + Nick.Length).ToString()) <===this data would not dispaly
regards,
Herfried K. Wagner [MVP] wrote:
"Supra" <su*****@rogers.com> schrieb:
i have : mainform form2 had 2 textbox class1.vb class2.vb how do i create form2 into class2.vb? i couldn't do better. this is what i do.
in class2.vb public class class2 public frm2 as form2
sub new() MyBase.GetType() frm2 = new form2 frm2.mdiparent !! <===== i wanted frm2 to be mdichild end sub
Private Sub _Connection_onSeverMessage(ByVal szText As String) Handles _Connection.onSeverMessage DisplayMessage(frm2.text= szText.ToString) End Sub
but i got error problem. it is comming from form2. An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of an object.
You will have to make a reference to your MDI container available to your 'Class2', for example in a method parameter or a property:
\\\ Private m_MdiParent As Form
Public Sub New(ByVal MdiParent As Form) m_MdiParent = MdiParent End Sub
Public Sub ConnectionServerMessage(...) Handles... Dim f As New Form2() f.MdiParent = m_MdiParent f.Show() End Sub ///
Usage (in MDI container):
\\\ Dim c As New Class2(Me) ... ///
Supra,
"Supra" <su*****@rogers.com> schrieb: i don't needed to used this: Dim c As New Class2(Me)
Problem solved?
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
yes. i removed this
Dim c As New Class2(Me)
regards
ur example code is working... i can only do like this
Display ( frm.textbox1, "bla bla bla bla ",sztext)
but not in this:
Select Case C(1).Trim
Case "001" To "014", "251" To "272", "372" To "377","401", "422", "462", "468", "503"
Dim intA As Integer = CLi.IndexOf(Nick, 0)
RaiseEvent onSeverMessage(CLi.Substring(intA + Nick.Length).ToString())<===this data would not dispaly
regards
Herfried K. Wagner [MVP] wrote: Supra,
"Supra" <su*****@rogers.com> schrieb:
i don't needed to used this: Dim c As New Class2(Me)
Problem solved? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: C Learner |
last post by:
I have a ASP.NET web application.
It contains a WebForm1.aspx which extend class Page, and a class in
Class1.cs which extend Class2.cs class.
Inside the Class1.cs functions, I want to write...
|
by: PCH |
last post by:
posted on wrong ng :-)
Hello all,
I want to setup a program that will have several similar classes that with
have identitcal properties.
Im my main procedure I want to only declare 1 basic...
|
by: Vannela |
last post by:
In my unmanaged there is code i n this way
Class1 c1= new Class1(); // Class1 is one
object and creating a instance of it\
Class1 c2= new Class2();// Class2 is another object a...
|
by: ilPostino |
last post by:
Hi,
This is a strange question. Firstly, I'm working with custom classes,
nothing available in .net and I _don't_ want to add a parent property.
Here is the problem.
Lets say I have two...
|
by: Richard Lewis Haggard |
last post by:
Is it possible to put a reference to an object inside of a class? If so,
what is the syntax? The reason I want to do this is so that I can make a
copy of the original object, make modifications to...
|
by: vsr |
last post by:
I am calling one Method in Common class from different classes and i want to
know from which object the call is coming from.. is there any way?
|
by: slinky |
last post by:
On My Webserver I have an Access Database called "Warehouse.mdb"
I have a webform that has:
6 Textboxes named: txtAsset_Number.Text, txtDescription.Text,
txtSerial_Number.Text, txtMfg.Text,...
|
by: slinky |
last post by:
On My Webserver I have an Access Database called "Warehouse.mdb"
I have a webform that has:
6 Textboxes named: txtAsset_Number.Text, txtDescription.Text,
txtSerial_Number.Text, txtMfg.Text,...
|
by: groups2 |
last post by:
Can someone please explain the results below
We switched to PHP 5
if I make a copy of an object, and then change the variable inside the
object the change is reflected in the copy.
Either the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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...
|
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: 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...
| |