Search results for query: *

  1. B

    Set a string value for boolean True/False

    Is it possible to output a boolean value True/False to say Yes/No instead?
  2. 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()...
  3. 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.
  4. 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...
  5. 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"...
  6. 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...
  7. 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?
  8. 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 {...
  9. 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;
  10. 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 =...
  11. 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...
  12. 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 :)
  13. B

    Question Added property don't update data source

    Yes it's declared as public public string AnimalType { get { return this.GetType().Name; } set { } }
  14. 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?
  15. 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.
  16. B

    Question Your opinion regarding constructor

    Thanks for your quick answer! That would probably be a good idea! But if I keep this for now, should the following be removed in the puppy class? How else would I set age to 0 when it's a puppy? override public int Age { get; set; } = 0; Removing the inhertied fields leave me with some errors...
  17. B

    Question Your opinion regarding constructor

    If you look at the code below. What would you say is wrong with the Puppy constructor? Is there any obvious between the classes the class Dog and the inherited Puppy? class Puppy : Dog { // Properties public int AgeInMonths { get; set; } override public int Age {...
  18. B

    Question Remove the object invoking a class/method

    Okey! I've handed in the assignment. Didn't have time to open a new thread regarding this.
  19. B

    Question Remove the object invoking a class/method

    Oki, what does it look like when a pet call each toy? Say that a cat damage the Ball with 2 while a dog damage it with 4?
Back
Top Bottom