473,394 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

'System.NullReferenceException

An unhandled exception of type 'System.NullReferenceException' occurred
in irc_client.exe
Additional information: Object reference not set to an instance of an
object.

'UPGRADE_WARNING: Arrays can't be declared with New. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1045"'
Public ChannelArray() As frmChannel

Dim intArrayCount As Short
intArrayCount= ChannelArray.GetUpperBound(0) <== error occured in this
in yellow highlightened

regards,
Nov 21 '05 #1
9 1704
That happens because the ChannelArray variable has not been assigned and it
is Nothing.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Supra" <su***@domain.invalid> escribió en el mensaje
news:KJ********************@rogers.com...
An unhandled exception of type 'System.NullReferenceException' occurred in
irc_client.exe
Additional information: Object reference not set to an instance of an
object.

'UPGRADE_WARNING: Arrays can't be declared with New. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1045"'
Public ChannelArray() As frmChannel

Dim intArrayCount As Short
intArrayCount= ChannelArray.GetUpperBound(0) <== error occured in this in
yellow highlightened

regards,

Nov 21 '05 #2
can i add new keyword in variable?
Public ChannelArray() As new frmChannel < i added new keyword... does
this help?
regards

Carlos J. Quintero [.NET MVP] wrote:
That happens because the ChannelArray variable has not been assigned and it
is Nothing.


Nov 21 '05 #3
No, arrays can not use the New keyword.

If the size of the array is known, you can initialize the array as follows:

Public ChannelArray(10) As frmChannel

Otherwise, you could use an ArrayList class instead, for example:

Public ChannelArray As New ArrayList()

and then use the ChannelArray.Add(...) method.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Supra" <su***@domain.invalid> escribió en el mensaje news:Fb********************@rogers.com...
can i add new keyword in variable?
Public ChannelArray() As new frmChannel < i added new keyword... does this help?
regards
Nov 21 '05 #4
"Supra" <su***@domain.invalid> schrieb:
An unhandled exception of type 'System.NullReferenceException' occurred
in irc_client.exe
Additional information: Object reference not set to an instance of an
object.

'UPGRADE_WARNING: Arrays can't be declared with New. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1045"'
Public ChannelArray() As frmChannel
=> 'Public ChannelArray(-1) As frmChannel'
intArrayCount= ChannelArray.GetUpperBound(0) <== error occured in this


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #5
that what i was going to asked u about arrylist
i will try both...if not..... :-(
regards

Carlos J. Quintero [.NET MVP] wrote:
No, arrays can not use the New keyword.

If the size of the array is known, you can initialize the array as
follows:

Public ChannelArray(10) As frmChannel

Otherwise, you could use an ArrayList class instead, for example:

Public ChannelArray As New ArrayList()

and then use the ChannelArray.Add(...) method.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Supra" <su***@domain.invalid <mailto:su***@domain.invalid>>
escribió en el mensaje news:Fb********************@rogers.com...
can i add new keyword in variable?
Public ChannelArray() As new frmChannel < i added new keyword...
does this help?
regards


Nov 21 '05 #6
"Supra" <su***@domain.invalid> schrieb:
can i add new keyword in variable?
Public ChannelArray() As new frmChannel < i added new keyword... does


\\\
Public ChannelArray() As frmChannel = New frmChannel() {}
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #7
Supra,

Can you explain what you want to achieve, because clearing the error will
not be a problem, however in my idea don't you than have with that the
sollution you want.

Cor
Nov 21 '05 #8
Apart from the array statements that exist in each language, the .NET Framework provides you also classes that are arrays, collections, dictionaries, queues, stacks, etc. They provide specialized behaviors that are needed sometimes. Take a look at the docs.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Supra" <su***@domain.invalid> escribió en el mensaje news:gO********************@rogers.com...
that what i was going to asked u about arrylist
i will try both...if not..... :-(
regards
Nov 21 '05 #9
thank u :-) . i take that variables
regards

Herfried K. Wagner [MVP] wrote:
"Supra" <su***@domain.invalid> schrieb:
can i add new keyword in variable?
Public ChannelArray() As new frmChannel < i added new keyword... does

\\\
Public ChannelArray() As frmChannel = New frmChannel() {}
///

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Terrence | last post by:
I am doing some of the C# walkthroughs to transition from VB to C#. When I try to execute static void Main() { Aplication.Run(new Form1()) } I raise a 'System.NullReferenceException" in...
1
by: Rafael | last post by:
Hi, I hope I can find some help for this problem IDE: Visual Studio.NET 2003 Developer Editio Language: C# Problem: "An unhandled exception of type 'System.NullReferenceException' occurred in...
7
by: mike p. | last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl stylesheets to do xhtml transform. Transform works fine when using MSXML. When I try to do the following using asp.net 1.1: ...
0
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
0
by: Matthias Kwiedor | last post by:
Hi! I want to create a WebBrowser Control at runtime. So i ported the "at start creation" of the Control to a new routine. Everything works fine, but i implement the BeforeNavigateFix and a...
2
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item...
1
by: msnews.microsoft.com | last post by:
I'm trying to fill an array of objects but when I add the first object I get a NullReferenceException. ----------------------------------------------------------------------------...
2
by: sxiao | last post by:
Hi, there I got a NullReferenceException when there are more than one users trying to open the same page at the same time. The senerio is: Two users logged into the web application using the...
6
by: William Mild | last post by:
I must be getting brain fried. I can't see the error. Create a new web form with the following code begind: Public Class test Inherits System.Web.UI.Page Public Class ReportCardData ...
3
by: Alex J. | last post by:
I just started to learn C# (my background is in C++), and right now I study the sockets, TCP/IP etc... so, I found a usefull source code at:...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.