16,021,041 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Little Daffodil (Top 8 by date)
Little Daffodil
23-Nov-10 8:10am
View
thanks..
that's a very long article.. wow!
Little Daffodil
23-Nov-10 5:27am
View
I tried this:
if (comboBoxLabNumber.SelectedIndex < 0 | comboBoxProblem.SelectedIndex <0)
{
MessageBox.Show("Please select the lab number and the problem");
}
string LabName = comboBoxLabNumber.SelectedItem.ToString();
string LabNumber = LabName;
string LabProblem = comboBoxProblem.SelectedItem.ToString();
string LabProb = LabProblem;
Yes, it works. However, this message of "Error: Object reference not set to an instance of an objet." still comes out.
Little Daffodil
23-Nov-10 5:24am
View
I'm blur. Does it mean this way?
if (comboBoxLabNumber.SelectedIndex > -1 | comboBoxProblem.SelectedIndex > -1)
{
}
else
{
MessageBox.Show("Please select an item!");
}
string LabName = comboBoxLabNumber.SelectedItem.ToString();
string LabNumber = LabName;
string LabProblem = comboBoxProblem.SelectedItem.ToString();
string LabProb = LabProblem;
Little Daffodil
23-Nov-10 5:08am
View
I tried this:
if (comboBoxLabNumber.SelectedIndex > -1 | comboBoxProblem.SelectedIndex > -1)
{
string LabName = comboBoxLabNumber.SelectedItem.ToString();
string LabNumber = LabName;
string LabProblem = comboBoxProblem.SelectedItem.ToString();
string LabProb = LabProblem;
}
else
{
MessageBox.Show("Please select an item!");
}
However, it comes out as error : The name 'LabName' and 'LabProblem' does not exist in the current context.
Little Daffodil
19-Nov-10 0:46am
View
It worked!
Thanks a lot, Alegria_Lee.
Little Daffodil
18-Nov-10 8:55am
View
I've managed to get what I want. This is my code:
using (StreamReader sr = File.OpenText(@"C:\config.txt"))
{
String input;
string[] lines = File.ReadAllLines(@"C:\config.txt");
while ((input = sr.ReadLine()) != null)
{
int i;
// if ((input = sr.ReadLine()) != null)
for (i = 0; i < 2; i++)
{
input = lines[i];
}
}
MessageBox.Show("COM Port is " + lines[0]);
MessageBox.Show("Phone number is " + lines[1]);
}
Little Daffodil
18-Nov-10 8:46am
View
thatraja, this is what I'm trying to do:
using (StreamReader sr = File.OpenText(@"C:config.txt"))
{
String input;
string[] lines = new string[2];
while ((input = sr.ReadLine()) != null)
{
int i;
if ((input = sr.ReadLine()) != null)
{
for (i = 0; i < 2; i++)
{
input = lines[i];
}
MessageBox.Show("COM Port is " + lines[0]);
MessageBox.Show("Phone number is " + lines[1]);
}
}
}
However, it's not working. MessageBox does not appear the comport and phone number. :-(
My main problem now is how do I assign each line read from the file as a string variable.. Please help.
Thanks.
(btw, from my reading, i still dont quite get the concept of stringbuilder :-( )
Little Daffodil
15-Nov-10 9:35am
View
ok, i need to understand the stringbuilder 1st.. ill get back to this post later.
thanks thatraja!
Show More