Click here to Skip to main content
15,843,727 members
Home / Discussions / C#
   

C#

 
GeneralRe: Join 3 tables error : Incorrect syntax near '.'. Pin
Richard Deeming16-Apr-20 5:23
mveRichard Deeming16-Apr-20 5:23 
GeneralRe: Join 3 tables error : Incorrect syntax near '.'. Pin
Member 1266420916-Apr-20 6:07
Member 1266420916-Apr-20 6:07 
GeneralRe: Join 3 tables error : Incorrect syntax near '.'. Pin
Richard Deeming16-Apr-20 6:10
mveRichard Deeming16-Apr-20 6:10 
GeneralRe: Join 3 tables error : Incorrect syntax near '.'. Pin
OriginalGriff16-Apr-20 6:37
mveOriginalGriff16-Apr-20 6:37 
Questionfilling a column with property value of object Pin
Aresto196414-Apr-20 21:39
Aresto196414-Apr-20 21:39 
AnswerRe: filling a column with property value of object Pin
joost.versteegen14-Apr-20 21:52
joost.versteegen14-Apr-20 21:52 
GeneralRe: filling a column with property value of object Pin
Aresto196415-Apr-20 4:33
Aresto196415-Apr-20 4:33 
AnswerRe: filling a column with property value of object Pin
OriginalGriff14-Apr-20 22:34
mveOriginalGriff14-Apr-20 22:34 
First, fix the compilation errors in your code: use of ')" where it should be '}', missing class keyword on class definitions, missing uppercase on List, that sort of thing.
So us code that works to demonstrate your problem - not a lump of crap your threw together and didn't check at all ...

You can display what you want as the cell content, just override ToStrign in your class:
C#
public class myclass2
    {
    public int Id { set; get; }
    public string Name { set; get; }
    public override string ToString()
        {
        return $"{Id}:{Name}";
        }
    }


You can also set the column header text to something more human readable than the property name - just set the HeaderText property of the column:
C#
myDataGridView.DataSource = mylist;
myDataGridView.Columns[1].HeaderText = "My other class";

"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!

QuestionTarga files displayed in openFileDialog Pin
MikeBr13-Apr-20 23:26
MikeBr13-Apr-20 23:26 
AnswerRe: Targa files displayed in openFileDialog Pin
OriginalGriff14-Apr-20 0:19
mveOriginalGriff14-Apr-20 0:19 
AnswerRe: Targa files displayed in openFileDialog Pin
Richard Deeming14-Apr-20 1:15
mveRichard Deeming14-Apr-20 1:15 
AnswerRe: Targa files displayed in openFileDialog Pin
Dave Kreskowiak14-Apr-20 5:37
mveDave Kreskowiak14-Apr-20 5:37 
QuestionProgramming Tcp with C# Pin
Member 1478193513-Apr-20 22:13
Member 1478193513-Apr-20 22:13 
AnswerRe: Programming Tcp with C# Pin
OriginalGriff13-Apr-20 22:25
mveOriginalGriff13-Apr-20 22:25 
GeneralRe: Programming Tcp with C# Pin
Member 1478193519-Apr-20 4:24
Member 1478193519-Apr-20 4:24 
QuestionSaving usercontrol design-time properties Pin
Crazy Joe Devola13-Apr-20 15:49
Crazy Joe Devola13-Apr-20 15:49 
AnswerRe: Saving usercontrol design-time properties Pin
OriginalGriff13-Apr-20 21:00
mveOriginalGriff13-Apr-20 21:00 
AnswerRe: Saving usercontrol design-time properties Pin
Richard Deeming14-Apr-20 1:13
mveRichard Deeming14-Apr-20 1:13 
GeneralRe: Saving usercontrol design-time properties Pin
Crazy Joe Devola14-Apr-20 14:45
Crazy Joe Devola14-Apr-20 14:45 
QuestionPrint Multiple Page in c# Pin
Mohamed Fahad13-Apr-20 10:08
Mohamed Fahad13-Apr-20 10:08 
AnswerRe: Print Multiple Page in c# Pin
Pete O'Hanlon13-Apr-20 10:30
subeditorPete O'Hanlon13-Apr-20 10:30 
QuestionMulti threading in c# Pin
User-862169513-Apr-20 2:49
User-862169513-Apr-20 2:49 
AnswerRe: Multi threading in c# Pin
OriginalGriff13-Apr-20 4:00
mveOriginalGriff13-Apr-20 4:00 
QuestionOPC Client Using C# Titanium Library Pin
Member 147907399-Apr-20 21:17
Member 147907399-Apr-20 21:17 
AnswerRe: OPC Client Using C# Titanium Library Pin
Gerry Schmitz10-Apr-20 7:46
mveGerry Schmitz10-Apr-20 7:46 

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.