Recent content by bondra

  1. B

    Answered Adding different buttons to rows datagridview

    I'm using DataGridViewButtonColumn already. But only gets one type of button. Would like one that says "Buy toy" and one "Play" so I can target each one. This is what my code for creating the "Buy button" looks like, which creates the first image in #1. DataTable dt = new DataTable()...
  2. B

    Answered Adding different buttons to rows datagridview

    Is it possible to have custom buttons on different rows using Datagridview? I manage to have each button in two separate columns. But not in the same one. How can this be done? I can post the current code I'm using if needed.
  3. B

    Answered Get object sent with event

    Sorry about that. Difficult to keep names apart as a newbie. Thanks for pointing me in the right direction though. Yes it's the cellContentClick event. I don't think I follow completely though. I searched the data that's being retrived from the sender but couldn't find any object correlating to...
  4. B

    Resolved Get data from multiple sources?

    The outcome I manage to put togheter was this which works fine. public UserControlPlayAnimal() { InitializeComponent(); dt.Columns.Add("Namn", typeof(string)); dt.Columns.Add("Leksak", typeof(string)); dt.Columns.Add("Storlek"...
  5. B

    Answered Get object sent with event

    I have a button column in a datagrid. The datagrid is printing out a list of animals. When clicking the button column I would like to get the corresponding animal object. I found some interesting data that's being sent but this is as a string like: Doggy, Bone, Large, Button. What I'm looking...
  6. B

    Resolved Get data from multiple sources?

    Hmm are there other ways? This is how it's formated in my console application and prefered way to be displayed in my windows form app. Can the code be reused from the console app?
  7. B

    Resolved Get data from multiple sources?

    I'm trying to get data from two lists/sources to populate my datagrid view. I manage to print all fields for an animal but the list of Toys. How can I proceed with this one? What's the correct route? This is what my code looks like: Petowner.Pets.Add(new Cat {...
  8. B

    Answered Reach dataGridView within a user controller?

    I'm trying to reach dataGridView1 which is in a user controller. Syntax below is wrong.... any ideas what the correct one is? :) userControlListAnimals1.dataGridView1.DataSource = Pets;
  9. B

    DefaultCellStyle Forecolor only applies to one cell

    Hmm I think I set it beforehand? private void Form1_Load(object sender, EventArgs e) { dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Yellow; Pets.Add(new Cat() { Name = "Missy", Age = 4, FavFood = "Frolic", Breed = "Sheppard", IsHungry =...
  10. B

    DefaultCellStyle Forecolor only applies to one cell

    I'm trying to set a color for the DefaulyCellStyle property but in only color the first cell for some reason. Any ideas? // Set the selection background color for all the cells. dataGridView1.DefaultCellStyle.SelectionBackColor = Color.White...
  11. B

    Question Added property don't update data source

    Oh sorry! It's Windows Forms I'm talking about. Can you please move it to the correct forum :)
  12. B

    Question Added property don't update data source

    Yes it's declared as public public string AnimalType { get { return this.GetType().Name; } set { } }
  13. B

    Question Added property don't update data source

    I've added an propery in a class which I now trying to reach from my Data Grid View. It doesn't show up however. I've tried to add new Data Sources, removed the DataGridView and added a new one but that doesn't seem to do anything. Any ideas?
  14. B

    Question Your opinion regarding constructor

    I totally agree on this point. It's a school assignment so the purpose is more to show a class that's inheriting.
Top Bottom