Click here to Skip to main content
15,903,770 members
Home / Discussions / C#
   

C#

 
Questionhow to disable imagebutton in C# Pin
mohd rafi9-Sep-05 20:06
mohd rafi9-Sep-05 20:06 
AnswerRe: how to disable imagebutton in C# Pin
Guffa9-Sep-05 21:37
Guffa9-Sep-05 21:37 
QuestionC# Pin
mohd rafi9-Sep-05 19:23
mohd rafi9-Sep-05 19:23 
AnswerRe: C# Pin
Guffa9-Sep-05 21:24
Guffa9-Sep-05 21:24 
AnswerRe: C# Pin
Matt Gerrans10-Sep-05 20:05
Matt Gerrans10-Sep-05 20:05 
QuestionHow can i Find String in DataTable or DataSet. Pin
Member 18215449-Sep-05 18:57
Member 18215449-Sep-05 18:57 
AnswerRe: How can i Find String in DataTable or DataSet. Pin
enjoycrack9-Sep-05 19:16
enjoycrack9-Sep-05 19:16 
GeneralRe: How can i Find String in DataTable or DataSet. Pin
Member 182154410-Sep-05 17:08
Member 182154410-Sep-05 17:08 
QuestionFound incredible notepad like source editor Pin
Heinz_9-Sep-05 18:06
Heinz_9-Sep-05 18:06 
QuestionThreads, Socket and StateObject Pin
tekken229-Sep-05 16:31
tekken229-Sep-05 16:31 
AnswerRe: Threads, Socket and StateObject Pin
S. Senthil Kumar9-Sep-05 22:15
S. Senthil Kumar9-Sep-05 22:15 
GeneralRe: Threads, Socket and StateObject Pin
tekken2210-Sep-05 4:12
tekken2210-Sep-05 4:12 
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 

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.