MrShoes's Profile User Rating: -----

Reputation: 326 Architect
Group:
Expert
Active Posts:
514 (0.45 per day)
Joined:
13-June 12
Profile Views:
9,519
Last Active:
User is offline Jul 30 2015 07:57 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Playstation
Your Car:
Who Cares
Dream Kudos:
50
Expert In:
C#
Icon   MrShoes .Status == null

Posts I've Made

  1. In Topic: How to create an instance with parameters

    Posted 20 Jul 2015

    OK, to make things a little clearer, change the names of your parameters so they don't match the member names. It can reduce confusion.

    In your constructor, you're passing a variable of type PointF and you have a member variable named PointF. Don't you just want to set the member to be the variable passed in the constructor? Try this:

    public MyClass(PointF pos, Color color)
    {
    position = pos; 
    myColor = color;
    }
    


    You see what happened there? You passed some variables into a constructor and they get set as the instance's private members. What your code did was accept parameters, ignore them, and set the members to default values.
  2. In Topic: How to create an instance with parameters

    Posted 20 Jul 2015

    Yes. You don't have a constructor. That code actually won't compile, because of the method "myObject" which has no return type.

    If you change its signature to public MyClass(PointF position, Color myColor) then you have a constructor.

    However, in that method you accept a PointF named "position" but then look what you do with it. What do you think will happen on line 10?
  3. In Topic: WPF Conditional Binding

    Posted 5 May 2015

    There's a few ways to do this, but the easiest way I can think of is this: If using MVVM, you can bind the slider to a property in your VM. The get accessor for that property could then have a condition where it chooses the value to change based on the selected radiobutton. You could instead use triggers to set the binding in the view. This SO answer is a good, simple example.
  4. In Topic: Sorting at datagridview c#

    Posted 22 Apr 2015

    Why not try sorting the DataSource instead of the DataGridView? Is this Windows Forms or WPF? On a side note, your KeyPress event handling method "txt_proximity_KeyPress" has way too much going on, you should consider separating it into a method in case it needs using during another event later. Your naming conventions are a bit inconsistent too. NAMES_LIKE_THIS, for example, usually indicate constants by convention (also yuck, I hate it), but here it's used for a method.
  5. In Topic: Very New... want to create folders for files

    Posted 22 Apr 2015

    As well as Directory.GetCurrentDirectory(), you'll probably want to use Directory.EnumerateFiles() and File.Copy(), which have detailed explanations on MSDN. As for a tutorial, I doubt there's one to meet your exact program requirements. However, what you want to do is pretty simple. Keep following "Learn C#" tutorials (of which this site has several series) until you understand all the concepts and can apply them.

My Information

Member Title:
D.I.C Addict
Age:
Age Unknown
Birthday:
December 19
Gender:
Location:
United Kingdom
Full Name:
Ian Hughes
Programming Languages:
C, C++, C#, JavaScript, WPF, XAML, HTML, SQL, SAS, BASIC

Contact Information

E-mail:
Private
Facebook:
http://www.facebook.com/ihughes1
Twitter:
@Mr_Shoes

Comments

Page 1 of 1
  1. Photo

    Michael26 Icon

    19 Jul 2013 - 23:16
    Congrats on promotion.
Page 1 of 1