Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel 10 1267
Validation Class instantiated how?
"shapper" <md*****@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel
On Oct 31, 12:40 am, "IfThenElse" <sql_agent...@hotmail.comwrote:
Validation Class instantiated how?
"shapper" <mdmo...@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel
Well, I am not using something in my code as follows:
Dim val As New Validation
val.IsRequired = True
val. ...
MyControl.Validation = val
Is this what you mean?
I am not doing this.
Do I need to do this?
But can't I declare a property of type class and then define it?
Thanks,
Miguel
On Oct 31, 2:44 am, shapper <mdmo...@gmail.comwrote:
On Oct 31, 12:40 am, "IfThenElse" <sql_agent...@hotmail.comwrote:
Validation Class instantiated how?
"shapper" <mdmo...@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel
Well, I am not using something in my code as follows:
Dim val As New Validation
val.IsRequired = True
val. ...
MyControl.Validation = val
Is this what you mean?
I am not doing this.
Do I need to do this?
But can't I declare a property of type class and then define it?
Thanks,
Miguel- Hide quoted text -
- Show quoted text -
Miguel, he means that Validation Class is null and this is the reason
why you got "object reference not set to an instance of an object".
You need to have something like this
Private _Validation As Validation = New Validation
On Oct 31, 8:33 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Oct 31, 2:44 am, shapper <mdmo...@gmail.comwrote:
On Oct 31, 12:40 am, "IfThenElse" <sql_agent...@hotmail.comwrote:
Validation Class instantiated how?
"shapper" <mdmo...@gmail.comwrote in message
>news:11**********************@o80g2000hse.googleg roups.com...
Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel
Well, I am not using something in my code as follows:
Dim val As New Validation
val.IsRequired = True
val. ...
MyControl.Validation = val
Is this what you mean?
I am not doing this.
Do I need to do this?
But can't I declare a property of type class and then define it?
Thanks,
Miguel- Hide quoted text -
- Show quoted text -
Miguel, he means that Validation Class is null and this is the reason
why you got "object reference not set to an instance of an object".
You need to have something like this
Private _Validation As Validation = New Validation
Bah, it is not the first time that this happens to my.
I copy paste a property from another another which is of type string
and I miss the New.
I wonder if Microsoft is going to implement the following features in
VB.NET as there is in C# in .NET Framework 3.5?
Does anyone knows?
Thanks,
Miguel
On Oct 31, 11:52 am, shapper <mdmo...@gmail.comwrote:
On Oct 31, 8:33 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Oct 31, 2:44 am, shapper <mdmo...@gmail.comwrote:
On Oct 31, 12:40 am, "IfThenElse" <sql_agent...@hotmail.comwrote:
Validation Class instantiated how?
"shapper" <mdmo...@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel
Well, I am not using something in my code as follows:
Dim val As New Validation
val.IsRequired = True
val. ...
MyControl.Validation = val
Is this what you mean?
I am not doing this.
Do I need to do this?
But can't I declare a property of type class and then define it?
Thanks,
Miguel- Hide quoted text -
- Show quoted text -
Miguel, he means that Validation Class is null and this is the reason
why you got "object reference not set to an instance of an object".
You need to have something like this
Private _Validation As Validation = New Validation
Bah, it is not the first time that this happens to my.
I copy paste a property from another another which is of type string
and I miss the New.
I wonder if Microsoft is going to implement the following features in
VB.NET as there is in C# in .NET Framework 3.5?
Does anyone knows?
Thanks,
Miguel- Hide quoted text -
- Show quoted text -
What features?
When you declared Shared class or method then you would not need to
create a New instance of a class/method. It's up to you and depends on
design
On Oct 31, 11:22 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Oct 31, 11:52 am, shapper <mdmo...@gmail.comwrote:
On Oct 31, 8:33 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Oct 31, 2:44 am, shapper <mdmo...@gmail.comwrote:
On Oct 31, 12:40 am, "IfThenElse" <sql_agent...@hotmail.comwrote:
Validation Class instantiated how?
"shapper" <mdmo...@gmail.comwrote in message
>news:11**********************@o80g2000hse.googleg roups.com...
Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel
Well, I am not using something in my code as follows:
Dim val As New Validation
val.IsRequired = True
val. ...
MyControl.Validation = val
Is this what you mean?
I am not doing this.
Do I need to do this?
But can't I declare a property of type class and then define it?
Thanks,
Miguel- Hide quoted text -
- Show quoted text -
Miguel, he means that Validation Class is null and this is the reason
why you got "object reference not set to an instance of an object".
You need to have something like this
Private _Validation As Validation = New Validation
Bah, it is not the first time that this happens to my.
I copy paste a property from another another which is of type string
and I miss the New.
I wonder if Microsoft is going to implement the following features in
VB.NET as there is in C# in .NET Framework 3.5?
Does anyone knows?
Thanks,
Miguel- Hide quoted text -
- Show quoted text -
What features?
When you declared Shared class or method then you would not need to
create a New instance of a class/method. It's up to you and depends on
design
Oops, didn't post the link (Automatic Properties): http://weblogs.asp.net/scottgu/archi...tializers.aspx
Thanks,
Miguel
On Oct 31, 12:37 pm, shapper <mdmo...@gmail.comwrote:
Oops, didn't post the link (Automatic Properties):http://weblogs.asp.net/scottgu/archi...-orcas-languag...
Not in the same way. In C# 3.5 you could use "unassigned" properties
like here
Person p = new Person();
p.FirstName = "Miguel";
Console.Write(p.FirstName); // "Miguel"
In VB.NET such construction would give you an empty string.
But unlike C# you can use "unassigned" GET properties in .NET 2, e.g.
Public Class Person
Public Property FirstName() As String
Get
End Get
Set(ByVal value As String)
End Set
End Property
....
End Class
would work without any problem. And in C# you cannot do it.
BTW, you can get Orcas Beta 2 and test all new things by yourself http://msdn2.microsoft.com/vstudio/aa700831.aspx
On Oct 31, 12:31 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Oct 31, 12:37 pm, shapper <mdmo...@gmail.comwrote:
Oops, didn't post the link (Automatic Properties):http://weblogs.asp.net/scottgu/archi...-orcas-languag...
Not in the same way. In C# 3.5 you could use "unassigned" properties
like here
Person p = new Person();
p.FirstName = "Miguel";
Console.Write(p.FirstName); // "Miguel"
In VB.NET such construction would give you an empty string.
But unlike C# you can use "unassigned" GET properties in .NET 2, e.g.
Public Class Person
Public Property FirstName() As String
Get
End Get
Set(ByVal value As String)
End Set
End Property
...
End Class
would work without any problem. And in C# you cannot do it.
BTW, you can get Orcas Beta 2 and test all new things by yourselfhttp://msdn2.microsoft.com/vstudio/aa700831.aspx
Thanks Alexey,
Miguel
Why not instantiate the variabele with the definition, in c# i would
do something like:
private Validation _validation = new Validation();
It probably would be something like this in VB.Net:
Private _Validation as new Validation
That way you would always have a valid object instance....
Greets.
On Tue, 30 Oct 2007 18:44:37 -0700, shapper <md*****@gmail.comwrote:
>On Oct 31, 12:40 am, "IfThenElse" <sql_agent...@hotmail.comwrote:
>Validation Class instantiated how?
"shapper" <mdmo...@gmail.comwrote in message
news:11**********************@o80g2000hse.googleg roups.com...
Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel
Well, I am not using something in my code as follows: Dim val As New Validation val.IsRequired = True val. ...
MyControl.Validation = val
Is this what you mean?
I am not doing this.
Do I need to do this?
But can't I declare a property of type class and then define it?
Thanks, Miguel
On Nov 2, 7:56 pm, John MJ Gorter <john.gor...@gmail.comwrote:
Why not instantiate the variabele with the definition, in c# i would
do something like:
private Validation _validation = new Validation();
It probably would be something like this in VB.Net:
Private _Validation as new Validation
That way you would always have a valid object instance....
Greets.
On Tue, 30 Oct 2007 18:44:37 -0700, shapper <mdmo...@gmail.comwrote:
On Oct 31, 12:40 am, "IfThenElse" <sql_agent...@hotmail.comwrote:
Validation Class instantiated how?
"shapper" <mdmo...@gmail.comwrote in message
>news:11**********************@o80g2000hse.googleg roups.com...
Hello,
I have a custom control under namespace MyNameSpace.WebControls with a
property of type validation:
' Validation
Private _Validation As Validation
< _
Bindable(True), _
Category("Behavior"), _
DefaultValue(""), _
Localizable(True) _
_
Public Property Validation() As Validation
Get
Return _Validation
End Get
Set(ByVal value As Validation)
_Validation = value
End Set
End Property ' Validation
Validation is class with various properties under the namespace
MyNameSpace:
' Validation
Public Class Validation
' IsRequired
Private _IsRequired As Boolean
Public Property IsRequired() As Boolean
Get
If _IsRequired = Nothing Then
_IsRequired = False
End If
Return _IsRequired
End Get
Set(ByVal value As Boolean)
_IsRequired = value
End Set
End Property ' IsRequired
..............
End Class
I am using my control in a page as follows:
Dim a As New MyControl
MyControl.Property1 = "Something"
MyControl.Property2 = True
It works!
When I add the following property:
MyControl.Validation.IsRequired = False
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
On code line:
MyControl.Validation.IsRequired = False
What am I doing wrong?
Thanks,
Miguel
Well, I am not using something in my code as follows:
Dim val As New Validation
val.IsRequired = True
val. ...
MyControl.Validation = val
Is this what you mean?
I am not doing this.
Do I need to do this?
But can't I declare a property of type class and then define it?
Thanks,
Miguel- Hide quoted text -
- Show quoted text -
we already found it some days ago This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Doug |
last post by:
I'm trying to create a user control that would have a ListDictionary
property. When trying to use the property and set values for this
collection, the dialog box that appears has everything...
|
by: |
last post by:
I'm going a little crazy trying to learn how to use arrays as properties in
VBScript classes. Hopefully someone can help. First, I can't figure out
whether it's possible to iterate through the...
|
by: Codemonkey |
last post by:
Just a silly question, but why can't you overload a writeonly property with
a readonly one? Surely the compiler can tell the difference of which one to
call at compile time, depending on if it is...
|
by: sklett |
last post by:
I just found myself doing something I haven't before:
<code>
public uint Duration
{
get
{
uint duration = 0;
foreach(Thing t in m_things)
{
duration += t.Duration;
|
by: AMDRIT |
last post by:
Hello everyone,
How do I access a property from another thread in VB'05? Thanks
public class frmblah
inherits system.windows.forms.form
private mCount as integer
private property Count...
|
by: LW |
last post by:
"Consider the U.S. government's recognition and protection of
intellectual property in the computer industry. Inventors of computer
hardware were able to patent their inventions, and the government...
|
by: Tony Girgenti |
last post by:
Hello.
I'm developing and testing a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
computer. I'm using a web form.
For a...
|
by: shapper |
last post by:
Hello,
I have a class where I created various controls.
One of the controls have a property which is a generic list of
WebControl.
Then in web site page I have something like:
Dim a As New...
|
by: Frinavale |
last post by:
So a while ago I created a Tab Strip Control (before the AjaxToolkit had theirs otherwise I would have probably just used theirs).
When I looked at the AjaxToolkit control to see how they got...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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: 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,...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |