Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
AnswerRe: Sql query designer Pin
Pete O'Hanlon31-Mar-09 0:48
mvePete O'Hanlon31-Mar-09 0:48 
QuestionWeb Service Pin
Javier Aballay30-Mar-09 13:39
Javier Aballay30-Mar-09 13:39 
AnswerRe: Web Service Pin
Christian Graus30-Mar-09 15:26
protectorChristian Graus30-Mar-09 15:26 
AnswerRe: Web Service Pin
Mycroft Holmes30-Mar-09 21:20
professionalMycroft Holmes30-Mar-09 21:20 
Questionhow to pass the server name or server address in an application ? Pin
ma.amer30-Mar-09 13:37
ma.amer30-Mar-09 13:37 
AnswerRe: how to pass the server name or server address in an application ? Pin
Christian Graus30-Mar-09 18:30
protectorChristian Graus30-Mar-09 18:30 
GeneralRe: how to pass the server name or server address in an application ? Pin
ma.amer1-Apr-09 4:24
ma.amer1-Apr-09 4:24 
QuestionProblem with removing columns and rows in dataGridView Pin
dariusUK30-Mar-09 11:15
dariusUK30-Mar-09 11:15 
Hi there,

I’m trying to write a program that reads .xls file, formats it by removing specific rows and columns into table, sorts the data and then displays the data in dataGridView.

The .xls file is not formatted into table and in order to do that I need to delete 4 first rows and 2 first columns.

And here’s the problem when I’m trying to do that the program removes only 2 first rows and columns one and three instead of one and two. Here’s the code:


//opens an .xls file, creates data table, fills the dataGridView with the data from dataTable object<br />
DataTable sampleDataTable = new DataTable();<br />
<br />
OleDbConnection aConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\file.xls;Extended Properties=Excel 8.0");<br />
<br />
aConnection.Open();<br />
           <br />
OleDbDataAdapter oleDbCommand = new OleDbDataAdapter("Select * from [file$]", aConnection);<br />
oleDbCommand.Fill(sampleDataTable);<br />
<br />
dataGridView1.DataSource = sampleDataTable;<br />
<br />
//formats file into table by removing rows and columns at specified index<br />
dataGridView1.Columns.RemoveAt(0);<br />
dataGridView1.Columns.RemoveAt(1);<br />
<br />
dataGridView1.Rows.RemoveAt(0);<br />
dataGridView1.Rows.RemoveAt(1);<br />
dataGridView1.Rows.RemoveAt(2);<br />
dataGridView1.Rows.RemoveAt(3);<br />


I don’t know what’s wrong as I tested it several times by programatiacally counting coulumns and rows but it’s still not working. It does work when I format the file before opening it by the program though.

Hope that somebody will point me in the right direction.

Thanks, Darius
AnswerRe: Problem with removing columns and rows in dataGridView Pin
howlettt30-Mar-09 11:48
howlettt30-Mar-09 11:48 
GeneralRe: Problem with removing columns and rows in dataGridView Pin
dariusUK31-Mar-09 11:07
dariusUK31-Mar-09 11:07 
QuestionHello, Can anyone help me how to navigate a web page which has frames using C# Pin
Vady_130-Mar-09 11:09
Vady_130-Mar-09 11:09 
AnswerRe: Hello, Can anyone help me how to navigate a web page which has frames using C# Pin
yafi31-Mar-09 0:11
yafi31-Mar-09 0:11 
GeneralRe: Hello, Can anyone help me how to navigate a web page which has frames using C# Pin
Vady_11-Apr-09 4:34
Vady_11-Apr-09 4:34 
Questionftp error "file not found, no access" Pin
T_Teef30-Mar-09 9:52
T_Teef30-Mar-09 9:52 
AnswerRe: ftp error "file not found, no access" [modified] Pin
EliottA30-Mar-09 10:15
EliottA30-Mar-09 10:15 
GeneralRe: ftp error "file not found, no access" Pin
T_Teef30-Mar-09 10:46
T_Teef30-Mar-09 10:46 
GeneralRe: ftp error "file not found, no access" Pin
EliottA30-Mar-09 10:52
EliottA30-Mar-09 10:52 
QuestionControlling an injected DLL Pin
Teuz30-Mar-09 8:50
Teuz30-Mar-09 8:50 
QuestionProblem whit inserting date - Oracle and C# Pin
E_Gold30-Mar-09 8:06
E_Gold30-Mar-09 8:06 
AnswerRe: Problem whit inserting date - Oracle and C# Pin
Giorgi Dalakishvili30-Mar-09 8:22
mentorGiorgi Dalakishvili30-Mar-09 8:22 
AnswerRe: Problem whit inserting date - Oracle and C# Pin
prubyholl30-Mar-09 8:23
professionalprubyholl30-Mar-09 8:23 
GeneralRe: Problem whit inserting date - Oracle and C# Pin
Dave Kreskowiak30-Mar-09 9:07
mveDave Kreskowiak30-Mar-09 9:07 
AnswerRe: Problem whit inserting date - Oracle and C# Pin
dan!sh 30-Mar-09 8:34
professional dan!sh 30-Mar-09 8:34 
AnswerRe: Problem whit inserting date - Oracle and C# [modified] Pin
Fayu30-Mar-09 8:37
Fayu30-Mar-09 8:37 
GeneralRe: Problem whit inserting date - Oracle and C# Pin
Thomas Krojer31-Mar-09 1:12
Thomas Krojer31-Mar-09 1: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.