Click here to Skip to main content
16,006,013 members
Home / Discussions / C#
   

C#

 
Questioncalculating Time Interval in C# Pin
majidbhutta21-Sep-05 8:50
majidbhutta21-Sep-05 8:50 
AnswerRe: calculating Time Interval in C# Pin
Dan Neely21-Sep-05 9:01
Dan Neely21-Sep-05 9:01 
QuestionContextMenu Pin
PHDENG8121-Sep-05 8:31
PHDENG8121-Sep-05 8:31 
AnswerRe: ContextMenu Pin
Wjousts21-Sep-05 9:42
Wjousts21-Sep-05 9:42 
QuestionEncoding Problem Pin
Meysam Mahfouzi21-Sep-05 8:13
Meysam Mahfouzi21-Sep-05 8:13 
AnswerRe: Encoding Problem Pin
David Stone21-Sep-05 10:55
sitebuilderDavid Stone21-Sep-05 10:55 
GeneralRe: Encoding Problem Pin
Meysam Mahfouzi21-Sep-05 18:27
Meysam Mahfouzi21-Sep-05 18:27 
Questionconfusion with datatable sorting/finding Pin
melanieab21-Sep-05 7:49
melanieab21-Sep-05 7:49 
Hi,
I'm a little confused about the datatable/dataview thing. I have a datatable (tCat) in a datagrid. I have a column (the primary key column) called file and a column called Customer (among other columns). Each record has it's own unique file number (in the file column), so that when the user clicks on a customer, the entire row is highlighted and the file number is recorded. My problem arises when a column other than File is sorted. I do the sort programatically, then try to re-select the file that was highlighted previous to the sort. But I can't figure out how to find the row index containing the integer (xFile) in the File column while the Customer column is sorted. Is it possible to have the tCat.DefaultView.Sort or DataView Sort set in one column while searching another?

Here, the table is first in Customer ascending order. After the sort to Customer DESC occurs I say:

tCat.DefaultView.Sort = "Customer DESC";
DataView dv = new DataView(tCat);
dv.Sort = "File";
row = dv.Find(xFile);
dg.Select(row);
Here, instead of finding the row that contains xFile, the xFileth row is highlighted.


I've also tried things like:

tCat.DefaultView.Sort = "File";
int xRow = tCat.DefaultView.Find("xFile");
dg.Select(xRow);
which results in what's on the screen being sorted by file order and the xFileth file highlighted.


This:

tCat.DefaultView.Sort = "Customer ASC";
int xRow = tCat.DefaultView.Find(xFile);
dg.Select(xRow);
results in an error (index = -1) since it searches the Customer column.

After days of trying to get this to work, I'm completely exhausted. Can anyone explain what I need to do to get this working?

Thanks so much!!!!!!!
Mel OMG | :OMG:
AnswerRe: confusion with datatable sorting/finding Pin
Wjousts21-Sep-05 9:52
Wjousts21-Sep-05 9:52 
GeneralRe: confusion with datatable sorting/finding Pin
melanieab21-Sep-05 10:23
melanieab21-Sep-05 10:23 
QuestionHelp! C#/ASP.NET/Dreamweaver Pin
Cpen21-Sep-05 7:29
Cpen21-Sep-05 7:29 
QuestionChange Font for DataGrid Column Pin
zaboboa21-Sep-05 6:27
zaboboa21-Sep-05 6:27 
AnswerRe: Change Font for DataGrid Column Pin
deep721-Sep-05 19:30
deep721-Sep-05 19:30 
GeneralRe: Change Font for DataGrid Column Pin
zaboboa22-Sep-05 2:56
zaboboa22-Sep-05 2:56 
QuestionUpdate MySQL databases Pin
Ming Luo21-Sep-05 6:19
Ming Luo21-Sep-05 6:19 
QuestionEditable tab page title Pin
MotherNuBBeR21-Sep-05 6:06
MotherNuBBeR21-Sep-05 6:06 
AnswerRe: Editable tab page title Pin
Dario Solera21-Sep-05 6:25
Dario Solera21-Sep-05 6:25 
QuestionHow to read text from the interface of another application? Pin
AndyH7021-Sep-05 5:38
AndyH7021-Sep-05 5:38 
QuestionMultiline Crystal Reports (Wrap Word) Pin
| Muhammad Waqas Butt |21-Sep-05 5:17
professional| Muhammad Waqas Butt |21-Sep-05 5:17 
Questioninstalled applications Pin
Mridang Agarwalla21-Sep-05 4:18
Mridang Agarwalla21-Sep-05 4:18 
AnswerRe: installed applications Pin
David Stone21-Sep-05 10:38
sitebuilderDavid Stone21-Sep-05 10:38 
QuestionActive X Control In C# Web App Pin
Adrian Metcalfe21-Sep-05 4:16
Adrian Metcalfe21-Sep-05 4:16 
AnswerRe: Active X Control In C# Web App Pin
Judah Gabriel Himango21-Sep-05 4:41
sponsorJudah Gabriel Himango21-Sep-05 4:41 
GeneralRe: Active X Control In C# Web App Pin
Adrian Metcalfe21-Sep-05 5:11
Adrian Metcalfe21-Sep-05 5:11 
GeneralRe: Active X Control In C# Web App Pin
Judah Gabriel Himango21-Sep-05 5:47
sponsorJudah Gabriel Himango21-Sep-05 5:47 

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.