|
Yes I understand how the If statement works and I think you are correct about reversing them. I tried using the continue statement that someone mentioned before... like:
if (DBNull.Value == r.Cells[12].Value) continue;
else richTextBox1.Text += string.Format("Notes: {0}\n", r.Cells[12].Value.ToString());
richTextBox1.Text += "\n\n";
the problem with this is if Cells[12] was actually DBNull, then for some reason it would skip the richTextBox1.Text += "\n\n"; ... now when I left continue out, it would work correctly. The program actually works like I wanted it to. I do think that you are correct and there are better ways of doing what I wanted it to do (which I'm sure you know). I'm still learning how things work exactly, and still learning how to make them more code friendly. Thanks
|
|
|
|
|
Jacob Dixon wrote: the problem with this is if Cells[12] was actually DBNull, then for some reason it would skip the richTextBox1.Text += "\n\n";
That is because continue moves to the start of the next iteration skipping any remaining statements in the current iteration.
|
|
|
|
|
Jacob Dixon wrote: When I enter like: 123-4567 it doesn't because of the dash.
You need to loop through the string and when you encounter a numeric character, add it to a temporary string, and ignore the none numeric characters. When done with the loop, you should be able to convert the temporary string to int32 with no problem.
---modified
Int32 is not always going to work if you include area codes. You might want to consider Int64 if you have store the phone numbers as integers.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
hi all
i work with database and i connetion to it
when aplay to connet to it the application send to me this message
Error [IM002][Microsoft][ODBC Driver Manager] DataSource name not found and no default driver specifies
thanks for any body help me
Thaer
|
|
|
|
|
There's something wrong with your connection string.
You need to provide details of this if you want help.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thaer Hamael wrote: DataSource name not found
Check to make sure that the data source you're connecting to has been setup properly. In WinXP go to [Start -> Settings -> Control Panel -> Administrative Tools -> Data Sources (ODBC)] to View/Modify your systems ODBC connections.
|
|
|
|
|
ODBC is soooo '80s... get with ADO.net, there's likely a provider for your database.
|
|
|
|
|
Hello All:
How can I add an icon for any element inside list view,
thanks
|
|
|
|
|
Step1 :
use one ImageList and load all required images !!!
Step 2:
Use ListViewItem Class object ListItemobj
Step3:
ListItemObj.ImageIndex= set image index from ImageList
Hope this will help you
|
|
|
|
|
i have created a report using crystal report and i want to open it in reportViwer in C# 2005 how can i do that ?
|
|
|
|
|
The ReportViewer is for SSRS reports, not Crystal Reports.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
so how can i display the crystal report
|
|
|
|
|
Did you try searching[^] for an answer to your question yourself?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
sure, so how to use reportviwer ?
|
|
|
|
|
shabonaa wrote: sure, so how to use reportviwer ?
I already told you, you can't use the Report Viewer control for Crystal Reports
The Report Viewer control is for displaying SSRS reports.
Which part of 'you can't use it' didn't you understand?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
how to set the report source. i was using it in VS 2003
|
|
|
|
|
you can you Crystal Reports viewer to view the reports .
give the Crystal Report Source !!!
|
|
|
|
|
As Paul has stated, Crystal Reports and ReportViewer are two different products.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
yes i tried it and it works, thats guys
|
|
|
|
|
Hi there,
I am trying to save an Image from a database to a file but it only save the following to the file
"System.Byte[]".
fileWriter.Write(dsExportDataTypes.Tables[0].Rows[i]["ATTACHMENT"]);
fileWriter is an object of StreamWriter Class.
Mujtaba
"If both of us are having one apple each and we exchange it, at the end we both will have one apple each. BUT if both of us are having one idea each and we exchange it, at the end both of us will be having two ideas each."
|
|
|
|
|
You're using the wrong class. StreamWriter is used for writing character data to streams. To save an image to a file, you need to use a class that will handle a binary stream of data. FileStream[^] is the most appropriate class to use. Your code would look like:
myFileStream.Write((byte[])dsExportDataTypes.Tables[0].Rows[i]["ATTACHMENT"]);
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hai All,
How can we open only one instance of a form at a time from a MDIparent form in C#.net
Thanks & Regards
|
|
|
|
|
this condition on Form1 would ensure that there's only one copy in the existence
if(obj == null || obj.IsDisposed)
{
obj = new Form2();
obj.Show();
}
Sathy
|
|
|
|
|
You can do that by having a "manager" class that manage the child form.
1. Caller call a method in the manager, given the type of the form that you want to open.
2. Manager check MdiChildren of that type, if it finds it, return the form object back to caller.
3. If manager not able to find it, then create a new instance via reflection, then return back to caller.
4. Caller receive the form, do necessary action on the form (pass object, show, etc)
You can mix it up a bit by having some form can only be opened as 1 instance, while other form can be opened multiple time, by adding customattribute to the form class or adding an "AllowMultiple" via subclassing Form.
This is by no means the only way.
|
|
|
|
|
Any idea on mouseover outside the form?
eg:the form is not on focus and when i mouseover a text from another program an action will trigger.
|
|
|
|