Click here to Skip to main content
15,891,633 members
Home / Discussions / C#
   

C#

 
GeneralRe: Drawing with c# Pin
trønderen24-Jun-22 17:02
trønderen24-Jun-22 17:02 
QuestionSimple Paint app in winforms Pin
Aafaan_Jii20-Jun-22 23:19
Aafaan_Jii20-Jun-22 23:19 
AnswerRe: Simple Paint app in winforms Pin
OriginalGriff20-Jun-22 23:40
mveOriginalGriff20-Jun-22 23:40 
AnswerRe: Simple Paint app in winforms Pin
Pete O'Hanlon21-Jun-22 2:18
mvePete O'Hanlon21-Jun-22 2:18 
AnswerRe: Simple Paint app in winforms Pin
Dave Kreskowiak21-Jun-22 4:39
mveDave Kreskowiak21-Jun-22 4:39 
AnswerRe: Simple Paint app in winforms Pin
Gerry Schmitz21-Jun-22 4:45
mveGerry Schmitz21-Jun-22 4:45 
QuestionHTML Input Controls Value Pin
Member 1431490219-Jun-22 18:46
Member 1431490219-Jun-22 18:46 
AnswerRe: HTML Input Controls Value Pin
OriginalGriff19-Jun-22 19:32
mveOriginalGriff19-Jun-22 19:32 
GeneralRe: HTML Input Controls Value Pin
Member 1431490219-Jun-22 19:47
Member 1431490219-Jun-22 19:47 
GeneralRe: HTML Input Controls Value Pin
Richard Deeming19-Jun-22 21:38
mveRichard Deeming19-Jun-22 21:38 
GeneralRe: HTML Input Controls Value Pin
OriginalGriff19-Jun-22 21:51
mveOriginalGriff19-Jun-22 21:51 
GeneralRe: HTML Input Controls Value Pin
Dave Kreskowiak20-Jun-22 3:49
mveDave Kreskowiak20-Jun-22 3:49 
GeneralRe: HTML Input Controls Value Pin
Member 1431490220-Jun-22 3:56
Member 1431490220-Jun-22 3:56 
GeneralRe: HTML Input Controls Value Pin
Dave Kreskowiak20-Jun-22 3:57
mveDave Kreskowiak20-Jun-22 3:57 
GeneralRe: HTML Input Controls Value Pin
Member 1431490220-Jun-22 3:58
Member 1431490220-Jun-22 3:58 
GeneralRe: HTML Input Controls Value Pin
Dave Kreskowiak20-Jun-22 4:00
mveDave Kreskowiak20-Jun-22 4:00 
GeneralRe: HTML Input Controls Value Pin
Mycroft Holmes20-Jun-22 12:31
professionalMycroft Holmes20-Jun-22 12:31 
QuestionHow filter a DataGridView filled from csv file... Pin
grennday11-Jun-22 21:06
grennday11-Jun-22 21:06 
Hello,
I filled up a DataGridView from a csv file using the code as follow:

Everything works and at the start I can see my DataGridView correctly filled up by datas from csv file.
The problem is that I am not able to filter the rows by textbox or sort the column by clicking on header word.
I tried differents ways by reading solution on the web but nothings works...
can anyone suggest me some solution for this pls?


C#
    private void LoadDatabaseBtn_Click(object sender, EventArgs e)
    {
        string filecsv = @"D:\Database.csv";
        DGV.DataSource = LoadCSV(filecsv);
        DGV.Refresh();
    }
    public List<Client> LoadCSV(string csvfile)
    {
       var query = from l in File.ReadAllLines(csvfile)
                    let data = l.Split(',')
                    select new Client
                    {
                        name= data[0],
                        id = data[1],
                        tel = data[2],
                        addr = data[3],
                        city = data[4],
                    };
        return query.ToList();
    }
}
public class Client
{
    public string name { get; set; }
    public string id { get; set; }
    public string tel { get; set; }
    public string addr { get; set; }
    public string city { get; set; }
}



I have an identical database .mdf, in this case I added a DataSets to my c# project and I fill up my DataGridView just by setting the ClientsTableBindingSouce as source of data
In this case I am able to sort and filter very easly the rows of the datagridview at runtime just by typing text in a textbox.

C#
private void filternameTxt_TextChanged(object sender, EventArgs e)
        {
            ClientsTableBindingSource.Filter = string.Format("name LIKE '%{0}%'", filternameTxt_Text);
            DGV.Refresh();
        }

AnswerRe: How filter a DataGridView filled from csv file... Pin
Richard MacCutchan11-Jun-22 21:18
mveRichard MacCutchan11-Jun-22 21:18 
GeneralRe: How filter a DataGridView filled from csv file... Pin
grennday15-Jun-22 19:40
grennday15-Jun-22 19:40 
GeneralRe: How filter a DataGridView filled from csv file... Pin
Richard MacCutchan15-Jun-22 22:03
mveRichard MacCutchan15-Jun-22 22:03 
GeneralRe: How filter a DataGridView filled from csv file... Pin
grennday16-Jun-22 20:15
grennday16-Jun-22 20:15 
GeneralRe: How filter a DataGridView filled from csv file... Pin
Richard MacCutchan16-Jun-22 20:55
mveRichard MacCutchan16-Jun-22 20:55 
GeneralRe: How filter a DataGridView filled from csv file... Pin
grennday17-Jun-22 19:47
grennday17-Jun-22 19:47 
GeneralRe: How filter a DataGridView filled from csv file... Pin
Richard MacCutchan17-Jun-22 21:59
mveRichard MacCutchan17-Jun-22 21:59 

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.