Click here to Skip to main content
15,890,506 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threads, Socket and StateObject Pin
S. Senthil Kumar10-Sep-05 4:40
S. Senthil Kumar10-Sep-05 4:40 
QuestionMath troubles Pin
KaptinKrunch9-Sep-05 15:02
KaptinKrunch9-Sep-05 15:02 
AnswerRe: Math troubles Pin
S. Senthil Kumar9-Sep-05 22:19
S. Senthil Kumar9-Sep-05 22:19 
AnswerRe: Math troubles Pin
Member 19610719-Sep-05 23:04
Member 19610719-Sep-05 23:04 
AnswerRe: Math troubles Pin
Andy Brummer10-Sep-05 6:33
sitebuilderAndy Brummer10-Sep-05 6:33 
AnswerRe: Math troubles Pin
KaptinKrunch10-Sep-05 8:39
KaptinKrunch10-Sep-05 8:39 
GeneralRe: Math troubles Pin
leppie10-Sep-05 10:04
leppie10-Sep-05 10:04 
QuestionRowCount of a DataTable Pin
surfman199-Sep-05 14:14
surfman199-Sep-05 14:14 
<br />
private void open_Database(string XML_DB_Name)<br />
{<br />
	dataSet.ReadXml(XML_DB_Name);<br />
	DataTable dt = dataSet.Tables[0];<br />
	string tblName = dt.TableName;<br />
	currentTable = dataSet.Tables[tblName];<br />
	dataGrid1.SetDataBinding(dataSet, tblName);<br />
	dataGrid1.CaptionText = tblName;<br />
<br />
	DataRow MyRow = currentTable.Rows[0];          <---- Problem when currentTable is empty, i get an exception...probably i can get the RowCount in another way?<br />
	int RowCount = MyRow.Table.Rows.Count;<br />
<br />
	// By default there is no DataGridTableStyle object.<br />
	// Add all DataSet table's style to the DataGrid<br />
	foreach(DataTable dTable in dataSet.Tables)<br />
	{<br />
		DataGridTableStyle dgStyle = new DataGridTableStyle();<br />
		dgStyle.MappingName = dTable.TableName;<br />
		if(RowCount < 8)<br />
		{<br />
			dgStyle.PreferredColumnWidth = 120;<br />
		}<br />
		else<br />
		{<br />
			dgStyle.PreferredColumnWidth = 110;<br />
		}<br />
		dataGrid1.TableStyles.Add(dgStyle);<br />
	}<br />
}<br />


i get this exception:
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.data.dll
Additional information: There is no row at position 0.
But i want to have the rowcount also when its 0!!

cu
AnswerRe: RowCount of a DataTable Pin
Expert Coming9-Sep-05 14:18
Expert Coming9-Sep-05 14:18 
GeneralRe: RowCount of a DataTable Pin
Andy Brummer9-Sep-05 14:49
sitebuilderAndy Brummer9-Sep-05 14:49 
AnswerRe: RowCount of a DataTable Pin
Gary Thom9-Sep-05 14:19
Gary Thom9-Sep-05 14:19 
AnswerRe: RowCount of a DataTable Pin
surfman199-Sep-05 14:20
surfman199-Sep-05 14:20 
QuestionDeserialize Error Pin
dicas9-Sep-05 13:50
dicas9-Sep-05 13:50 
AnswerRe: Deserialize Error Pin
Guffa9-Sep-05 13:56
Guffa9-Sep-05 13:56 
GeneralRe: Deserialize Error Pin
Daniel132410-Sep-05 2:21
Daniel132410-Sep-05 2:21 
QuestionHow to make DebugView see my program Pin
Susan Hernandez9-Sep-05 12:37
Susan Hernandez9-Sep-05 12:37 
AnswerRe: How to make DebugView see my program Pin
Andy Brummer9-Sep-05 15:01
sitebuilderAndy Brummer9-Sep-05 15:01 
GeneralRe: How to make DebugView see my program Pin
Susan Hernandez12-Sep-05 6:00
Susan Hernandez12-Sep-05 6:00 
AnswerRe: How to make DebugView see my program Pin
S. Senthil Kumar9-Sep-05 22:27
S. Senthil Kumar9-Sep-05 22:27 
GeneralRe: How to make DebugView see my program Pin
Susan Hernandez12-Sep-05 6:06
Susan Hernandez12-Sep-05 6:06 
QuestionData Table Error Pin
Expert Coming9-Sep-05 11:48
Expert Coming9-Sep-05 11:48 
AnswerRe: Data Table Error Pin
Andy Brummer9-Sep-05 12:26
sitebuilderAndy Brummer9-Sep-05 12:26 
GeneralRe: Data Table Error Pin
Expert Coming9-Sep-05 12:41
Expert Coming9-Sep-05 12:41 
GeneralRe: Data Table Error Pin
Alomgir Miah9-Sep-05 13:37
Alomgir Miah9-Sep-05 13:37 
AnswerRe: Data Table Error Pin
Guffa9-Sep-05 13:38
Guffa9-Sep-05 13:38 

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.