473,769 Members | 8,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.NullRefe renceException Error

I am trying to place an strings into an array of strings I am
declaring as
Dim Fields() As String

I have another variable im doing the same thing with and it works.

Public Shared Operations() As String

This is the error I am getting

System.NullRefe renceException: Object reference not set to an instance
of an object.

Here is my code
Public Class WebForm1
Inherits System.Web.UI.P age
Protected WebForm1 As System.Web.UI.H tmlControls.Htm lForm
Protected WithEvents Button1 As System.Web.UI.W ebControls.Butt on
Protected WithEvents DropDownList1 As
System.Web.UI.W ebControls.Drop DownList
Protected WithEvents TextBox1 As System.Web.UI.W ebControls.Text Box
Protected WithEvents ListBox1 As System.Web.UI.W ebControls.List Box
Protected WithEvents Repeater1 As
System.Web.UI.W ebControls.Repe ater
Protected WithEvents DataGrid1 As
System.Web.UI.W ebControls.Data Grid
Protected WithEvents DataList1 As
System.Web.UI.W ebControls.Data List
Protected WithEvents TextBox2 As System.Web.UI.W ebControls.Text Box
Public Shared Operations() As String
Dim FieldList As ClientResearch. Research
Dim Fields() As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
FieldList.GetFi eldListing(FEID , CID, UserName, Password,
Fields)
Try

If Not Fields Is Nothing Then
Dim txtBoxes(UBound (Fields)) As
System.Web.UI.W ebControls.Text Box
Dim j As Int32
Dim k As Int32 = 0
For j = 0 To UBound(Fields)
txtBoxes(j) = New TextBox()
txtBoxes(j).ID = Fields(j)
txtBoxes(j).Tex t = "Field " & Fields(j)
txtBoxes(j).Sty le("Position") = "Absolute"
txtBoxes(j).Sty le("Top") = "100px"
txtBoxes(j).Sty le("Left") = "100px"
WebForm1.Contro ls.Add(txtBoxes (j))
k = k + 5
Next j
End If
If Not Page.IsPostBack Then
If OperationsList( ) = "" Then
Dim Operations(0)
Operations(0) = "No Operations Found"
DropDownList1.I tems.Add(Operat ions(0))
Else
Dim i As Integer = 0
Operations = OperationsList. Split(",")
i = 0
For i = 0 To UBound(Operatio ns)
DropDownList1.I tems.Add(Operat ions(i))
Next
End If
End If

Catch ErrorMessage As Exception

TextBox1.Text = ErrorMessage.Me ssage() &
ErrorMessage.So urce

Finally

End Try
End Sub

It doesn't matter what I do, but i cannot get past this point.

I have even tried to Dim the array as Dim Fields(0) As String
and then setting Fields(0) = "Test" and during debug it Fails on this
line.
I cant find anything in the newsgroups except Dim Fields(-1) As String
but that does not work. Tried setting it to nothing, didnt work. The
Function GetFieldListing does not get called, it fails on that line.
If anyone can help I would greatly appreciate it.

Thank you in advance,

Eric
Jul 19 '05 #1
0 2256

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

Similar topics

7
8105
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: private void Page_Load(object sender, System.EventArgs e) { // load content XslTransform trans = new XslTransform();
0
9781
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" AutoPostBackOnNodeMove="false" DragAndDropEnabled="true" NodeEditingEnabled="False" KeyboardEnabled="true" CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode" HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit"
2
7845
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 in treeview i display the content item in axWebBrowser, i close the sub form normally when i close the main the following error is generated An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll ...
1
4099
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. ---------------------------------------------------------------------------- ------------------------------------------- Public Class TestClass Public NextSubIndex As Integer = 1 Public arrTestSubClass() As TestSubClass
4
5094
by: Terry Mulvany | last post by:
I have a 'BasePage' (BasePage.cs) derived from System.Web.UI.Page that all my pages inherit from. I need to set some properties (either in the OnInit or constructor) based on a potential Request.Cookie or a name/value pair in Request.QueryString. But I am getting a 'System.NullReferenceException: Object reference not set to an instance of an object.' error when I try to view any aspx derived from this BasePage. I am using...
4
1767
by: ven | last post by:
How must i declare my variables to have this code work. I get system.nullreferenceexception every time i click button to add data to datatable here below is my code : Dim wykszt as System.Data.DataTable Dim zatru as System.Data.DataTable Private Sub Page_Load(s As Object, e As EventArgs)
2
2783
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 Windows domain user account and tried to open the same page which has the databasde query code. When the two user tried to open the same page at the same time, there is a runtime error messsage showing as follows:
6
22223
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 Public Structure Attend Dim DaysTardy As Double
0
1218
by: sqlguy | last post by:
I am using a vendor package written in .net 2.0 C#. They say it works well, and that I may have a configuration issue. The error I am getting is shown below. Searching ms and google, it seems there is a hotfix, 2.0.50727.56, affecting SYSTEM.WEB.DLL which resolves this issue. Question: The vendor claims this works without the hotfix, can anyone provide clues for me? How do I obtain the hotfix, if needed? Thanks
2
5084
by: justmvb | last post by:
Error: EventType clr20r3, P1 redsmsservice.exe, P2 1.0.0.0, P3 48c0e7d0, P4 gsmcommunication, P5 1.10.0.0, P6 44d2c55f, P7 96, P8 3b, P9 system.nullreferenceexception, P10 NIL. System: System is developed in VS 2008, .Net 3.5 framework. It deals with GSM modem “Falcom Samba 75” for receiving and sending SMS to drivers, to deal with modem we had used third party free SMS Library. Client OS is Windows 2003 Server.
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10219
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.