Click here to Skip to main content
15,921,694 members
Home / Discussions / C#
   

C#

 
GeneralRe: Detecting if a "Using" directive is not available in different computers [modified] Pin
yoavyoavyoav14-Jan-08 4:29
yoavyoavyoav14-Jan-08 4:29 
GeneralRe: Detecting if a "Using" directive is not available in different computers Pin
mav.northwind15-Jan-08 1:30
mav.northwind15-Jan-08 1:30 
GeneralDatabase... Problems with a textbox converting.. Pin
Jacob Dixon12-Jan-08 4:57
Jacob Dixon12-Jan-08 4:57 
GeneralRe: Database... Problems with a textbox converting.. Pin
Colin Angus Mackay12-Jan-08 5:03
Colin Angus Mackay12-Jan-08 5:03 
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 
Sorry... here I will paste the entire coding.. what I ended up doing was just leaving it blank and it seems to work....

foreach (DataGridViewRow r in theTableDataGridView.Rows)
{
richTextBox1.Text += string.Format("{0} {1}\n", r.Cells[1].Value.ToString(), r.Cells[2].Value.ToString());

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

if (DBNull.Value == r.Cells[4].Value && DBNull.Value == r.Cells[5].Value && DBNull.Value == r.Cells[6].Value);

else if (DBNull.Value == r.Cells[4].Value && DBNull.Value != r.Cells[5].Value && DBNull.Value != r.Cells[6].Value) richTextBox1.Text += string.Format("{0}, {1}\n", r.Cells[5].Value.ToString(), r.Cells[6].Value.ToString());

else if (DBNull.Value != r.Cells[4].Value && DBNull.Value == r.Cells[5].Value && DBNull.Value != r.Cells[6].Value) richTextBox1.Text += string.Format("{0}, {1}\n", r.Cells[4].Value.ToString(), r.Cells[6].Value.ToString());

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

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

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

else richTextBox1.Text += string.Format("{0}, {1} {2}\n", r.Cells[4].Value.ToString(), r.Cells[5].Value.ToString(), r.Cells[6].Value.ToString());


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

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

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

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

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

richTextBox1.Text += "\n\n";
}




It appears to be work.. See I just left the IF statements without the RETURN. It seems to be working, I haven't ran into any problems yet..

Basically I just wanted to have it take the VALUE from the CELLS in a datagridview and display them in a certain format in a RichTextBox. Now If the cells were NULL then I did not want it to do anything.


Sorry to be so confusing, I'm trying to explain what I am trying to do.. Like I said it appears to be working and I thank you for trying to help me out.

-- Jacob Dixon
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 
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 

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.