h4nnib4l's Profile User Rating: -----

Reputation: 1183 Grandmaster
Group:
Contributor w/DIC++
Active Posts:
1,681 (1.15 per day)
Joined:
24-August 11
Profile Views:
23,465
Last Active:
User is offline Aug 25 2015 07:33 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
25

Latest Visitors

Icon   h4nnib4l hates Access. I hate it. I hate it.

Posts I've Made

  1. In Topic: Populate ObservableCollection from SQL class and access from ViewModel

    Posted 2 Jun 2015

    What Skydiver is saying is that in your first code sample, you are creating an instance of Models.M_Demo_DataGrid (called DemoDataGridModel) on line 29, adding a record to its List_Demo_Grid_Data property on line 30, and then DemoDataGridModel is dying when the curly brace closes on line 31. Do you understand what that means? For each row in your SqlDataReader, you're creating a new instance of the M_Demo_DataGrid, adding a single record to it, and then letting the garbage collector come clean it up before you ever do anything with it. You would need to move line 29 outside the while loop that you're opening on line 21. That way, the call to DemoDataGridModel.List_Demo_Grid_Data.Add() is adding all of the records to the same instance of the class. But that still won't fix your issue, because that instance of the class will still die as soon as the method ends, without ever sharing its information.

    If you're going to call PopulateDemoDataGrid from within the view model class, and you want it to populate an instance of the M_Demo_DataGrid class that the view model can interact with, you can follow one of two approaches. Either you can change the method signature of PopulateDemoDataGrid to accept a reference to an instance of M_Demo_DataGrid as a second argument, and then call List_Demo_Grid_Data.Add() against that instance, or you can made make the PopulateDemoDataGrid method return an instance of the M_Demo_DataGrid class. Either way, you need to get the instance against which the SQL functions were executed into your view model so you can work with it.

    I have to ask... is this code that you copy/pasted but don't really understand?


    EDIT: spelling
  2. In Topic: Converting typeof to instance type.

    Posted 30 Sep 2014

    What is the value of your receiver argument when the debugger first enters the constructor?

    EDIT: Also, IMO it's a lot easier to keep values straight in the debugger if you name your fields and your method arguments differently.
  3. In Topic: ListBox Values and Arrays

    Posted 22 Sep 2014

    How are you keeping track of the seats that are taken?
  4. In Topic: WPF still the way to go?

    Posted 28 Aug 2014

    A bit of a necro, but at VS Live Redmond this year, one of the speakers addressed the every-present "death of WPF" rumors. What he said was basically to the effect that Microsoft is a really nerdy company, so they tend to stop talking about things once they reach maturity in favor of the new shiny stuff. WPF is pretty much "done", as in updates will be few and far between (October 2013 for 4.5.1 for example), but that is in no way similar to dead. WinForms is deader than dead, and Silverlight should be dead for new development (though they mentioned that XAML for Windows RT is more like Silverlight than WPF), but WPF is the way to go for the foreseeable future.
  5. In Topic: Twitter: What's the point?

    Posted 9 May 2014

    View Postdepricated, on 09 May 2014 - 11:22 AM, said:

    Twitter is just facebook for the same kind of people who got confused about what a paragraph was in high school.


    And PC games are for people who can't make friends with real humans.

    Both statements are equally inaccurate and asinine...

My Information

Member Title:
The Noid
Age:
32 years old
Birthday:
March 7, 1983
Gender:
Location:
Texas
Years Programming:
4
Programming Languages:
C#, ASP.NET, HTML/CSS/JavaScript, SQL

Contact Information

E-mail:
Click here to e-mail me

Comments

Page 1 of 1
  1. Photo

    totgeburt Icon

    22 Jul 2012 - 15:20
    i was with 1/2 based out of camp lejeune. that's crazy because my best friend in the corp had the last name of Hopkins. who were you with bro?
  2. Photo

    trevster344 Icon

    28 Feb 2012 - 07:56
    I admire your about me message, and totally agree. Although not very old myself, I've always shared the same understanding.
Page 1 of 1