473,765 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error when opening a second open dialog

21 New Member
I have a program I am trying to write and I have it working the first time. The user clicks the OPEN button to open a txt file which the program loads into it's arrays. Everything works great until they try to open another one. When they do they get a nullreferenceer ror

private void GetQuestionList (string InputList)
{
StreamReader fs = File.OpenText(I nputList);
string input = null;

while ((input = fs.ReadLine()) != null)
lineCount = lineCount+1;
fs.Close();
QuestionLabel.T ext = Convert.ToStrin g(lineCount);

QuestionList = new string[lineCount, 5];

StreamReader fs1 = File.OpenText(I nputList);
int x = 0;
int yy = 0;
string[] split = null;
string input1 = null;
QuestionLabel.T ext = "";
while (x < lineCount)
{

input1 = fs1.ReadLine();
split = input1.Split(ne w Char[] { '|' });

while (yy!=split.Leng th)
{
QuestionList[x, yy] = split[yy];
yy = yy + 1;
}

x = x + 1;
yy = 0;
}
fs1.Close();
ShowQuestion();
thisQuestion = 0;
}



The error happens where i have it underlined, bolded. It only ever happens the second time they use the open dialog a second time. Any ideas or help would be great
Mar 25 '07 #1
2 1030
vanc
211 Recognized Expert New Member
you better try this condition instead of using "linecount" variable, this will reduce your code's complexity and may get your problem rid.

do
{

}
while (!stream.EndOfS tream);

if the problem is still, post back,
Cheers.
Mar 26 '07 #2
RobAMacAF
21 New Member
The reason I made it use line count is so it can make the string array the same size of the input file. I couldn't find a way besides looping though it once to figure out how many lines were in the text file.
Mar 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
6615
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
6
4752
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
1
2514
by: stigand | last post by:
Hi, I am building a small application using data access pages. I am trying to open a second window from my main form and access the document object with the following code: set newWin = window.open"http://localhost/fsi/dap/dapDe­tail.htm
5
6580
by: Bruce Schechter | last post by:
I just started to develop an ASP.NET application in vs.net 2003 . But each time I try to execute the application (which is basically empty so far), I get a dialog box titled "Microsoft Development Environment" with this message: "Error while trying to run project: Unable to start debugging on the web server. Server-side error occurred on sending debug HTTP request. Make sure the server is operating correctly. Verify there are no...
1
3701
by: Bon | last post by:
Hello all I create a form with three buttons in MS Access 2000. They are Open Excel Template, Save Draft and Save Final. When I click the Open Excel Template button, the Excel template will be opened. Inside the Excel template, I have assigned a draft watermark to the Print icon. When the Print icon is clicked, the draft watermark and print dialog box is shown. After the user print/edit data in the Excel template, s/he has to click
4
2141
by: sunil | last post by:
Hi, I have to open a word document from my aspx page.The Page_Load method contains the following code System.IO.TextWriter tx = Response.Output; System.IO.StreamReader sr = new System.IO.StreamReader(this.Path); Response.ContentType = "application/msword"; tx.Write(sr.ReadToEnd()); sr.Close();
3
1367
by: talluriajai | last post by:
Hi, I have an application developed where in, Upon click of a button, I am opening a modal dialog box with some records containing in it and clicking on one of the record its opening up another modal dialog box. after closing the second modal window and the first one when I am trying to open the same forms the whole application is getting hanged out. May I know the reason for this? Thanks, Ajai
7
2929
by: martin DH | last post by:
Hello, I have a report that I open that pull its data from a form that builds a where string. Opening the report first opens the form, where I enter criteria, and then pulls matching records from a table, opens the report, and closes the form. The code on the report is below. I used this code on a similar report that also pulled its data from a form (the difference was that that form supplied criteria to an actual query - my new form...
1
3157
by: =?Utf-8?B?cnNvbWFzdW5kYXI=?= | last post by:
Hi, I got the following error while trying to run the project in ASP.Net 2003 to one of my application in my machine. I think some where im loosing the IIS configurations. Error Detail: Auto-attach to process ' aspnet_wp.exe' on machine '<machine name>' failed. Error code 0x8004000e. Could you help me to find resolution.
0
9393
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
10007
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...
0
9832
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8830
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7371
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
6646
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();...
1
3921
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
3530
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2800
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.