Click here to Skip to main content
16,005,467 members
Home / Discussions / C#
   

C#

 
GeneralRe: Database... Problems with a textbox converting.. Pin
Jacob Dixon12-Jan-08 10:05
Jacob Dixon12-Jan-08 10:05 
GeneralRe: Database... Problems with a textbox converting.. Pin
Jacob Dixon12-Jan-08 10:23
Jacob Dixon12-Jan-08 10:23 
GeneralRe: Database... Problems with a textbox converting.. Pin
Colin Angus Mackay12-Jan-08 11:06
Colin Angus Mackay12-Jan-08 11:06 
GeneralRe: Database... Problems with a textbox converting.. Pin
Jacob Dixon12-Jan-08 11:16
Jacob Dixon12-Jan-08 11:16 
GeneralRe: Database... Problems with a textbox converting.. Pin
Gareth H12-Jan-08 12:57
Gareth H12-Jan-08 12:57 
GeneralRe: Database... Problems with a textbox converting.. Pin
Jacob Dixon12-Jan-08 16:01
Jacob Dixon12-Jan-08 16:01 
GeneralRe: Database... Problems with a textbox converting.. Pin
Colin Angus Mackay12-Jan-08 22:50
Colin Angus Mackay12-Jan-08 22:50 
GeneralRe: Database... Problems with a textbox converting.. Pin
Colin Angus Mackay12-Jan-08 22:57
Colin Angus Mackay12-Jan-08 22:57 
Jacob Dixon wrote:
As long as it skips the Else statement that is right after the IF statement!


I just re-read that if statement and it looks confusing

if (DBNull.Value == r.Cells[3].Value);
else richTextBox1.Text += string.Format("{0}\n", r.Cells[3].Value.ToString());


The reason it is confusing is that you have a do nothing semi-colon after the if. This is not normal practice (and if you are doing that as a matter of course then I suggest you stop)

The normal practice would be to reverse the if statement. So that the if has a != (not equal) instead of an == (equals) operator.

i.e.
if (DBNull.Value != r.Cells[3].Value)
    richTextBox1.Text += string.Format("{0}\n", r.Cells[3].Value.ToString());


You might also want to consider using a StringBuilder to build your string then finally assign it to the RichTextBox. It will be faster, especially for larger sets of data.


GeneralRe: Database... Problems with a textbox converting.. Pin
Jacob Dixon13-Jan-08 9:15
Jacob Dixon13-Jan-08 9:15 
GeneralRe: Database... Problems with a textbox converting.. Pin
Colin Angus Mackay13-Jan-08 9:46
Colin Angus Mackay13-Jan-08 9:46 
GeneralRe: Database... Problems with a textbox converting.. Pin
Paul Conrad13-Jan-08 6:40
professionalPaul Conrad13-Jan-08 6:40 
GeneralODBC connection Error Pin
Thaer Hamael12-Jan-08 4:05
Thaer Hamael12-Jan-08 4:05 
GeneralRe: ODBC connection Error Pin
pmarfleet12-Jan-08 6:48
pmarfleet12-Jan-08 6:48 
GeneralRe: ODBC connection Error Pin
Jimmanuel12-Jan-08 10:16
Jimmanuel12-Jan-08 10:16 
GeneralRe: ODBC connection Error Pin
PIEBALDconsult13-Jan-08 13:30
mvePIEBALDconsult13-Jan-08 13:30 
GeneralAn icon inside list view Pin
Strategic_Thinker12-Jan-08 2:57
Strategic_Thinker12-Jan-08 2:57 
GeneralRe: An icon inside list view Pin
Abhijit Jana12-Jan-08 3:08
professionalAbhijit Jana12-Jan-08 3:08 
Generalcrystal report Pin
shabonaa12-Jan-08 2:48
shabonaa12-Jan-08 2:48 
GeneralRe: crystal report Pin
pmarfleet12-Jan-08 2:51
pmarfleet12-Jan-08 2:51 
GeneralRe: crystal report Pin
shabonaa12-Jan-08 3:04
shabonaa12-Jan-08 3:04 
GeneralRe: crystal report Pin
pmarfleet12-Jan-08 3:12
pmarfleet12-Jan-08 3:12 
GeneralRe: crystal report Pin
shabonaa12-Jan-08 3:24
shabonaa12-Jan-08 3:24 
GeneralRe: crystal report Pin
pmarfleet12-Jan-08 3:34
pmarfleet12-Jan-08 3:34 
GeneralRe: crystal report Pin
shabonaa12-Jan-08 3:45
shabonaa12-Jan-08 3:45 
GeneralRe: crystal report Pin
Abhijit Jana12-Jan-08 3:17
professionalAbhijit Jana12-Jan-08 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.