|
hi everybody
i have a HD USB satellite card and i wiant my winform app to show tv and my records
is there a tool to show them ?
is there an activex ?
i am new in this field
somebody can help
its urgent
thanx alot
|
|
|
|
|
|
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
Okay, I understand that you can use the same variable when declaring the fields… Reference Variables, right?
My book goes on to say, "It is obvious that the keyword this cannot be used with static constructors or fields."…
I'm not sure what they are saying about not using the keyword "this" on static constructors or fields…
I know when you use the "static" keyword on a member/field it then belongs to the class it was declared in and when you create a static class that all members/fields/methods/properties must also be declared static…
For some reason I'm not making the connection on why you cannot use "this" keyword on static constructors or fields.
|
|
|
|
|
Look at it this way:
"this" refers to the current instance of this class that the code is running in.
Static classes do not have an "instance" (aka they are not created with the "new" operator), so therefore it does not make any sense to refer to members using the "this" keyword.
|
|
|
|
|
So, when you're using "this" keyword… It is kind of a shortcut method, instead of having to type out a whole new instance statement?
|
|
|
|
|
No, I guess its a little difficult to understand...
Every time you use the "new" operator you create an instance of the class. Think of a class as how an object behaves or can be interacted with in memory. Until you create an instance of it (for instance classes), you can't interact with it. Static methods do not get instantiated with the new operator, so they are not instance classes.
Sometimes you need to interact (internally) with the current instance of the class, that's when you use the "this" keyword.
For example, if you have:
public class Point
{
int x;
int y;
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
}
In the above, you need a way to differentiate between the x member of the class, and the x parameter of the method. You can do this with the "this" keyword, which says "set the member x of this instance of the class to x (the parameter of the method).
You still instantiate it with something like:
Point p = new Point(5,10);
this is only used internally in classes, the "this" keyword can only refer to the current instance of the class that you are in.
|
|
|
|
|
this Always points/refers to a member/field?
|
|
|
|
|
this is simply a reference to the current instance of the class, you use the '.' operator to refer to any member/field/method inside the current instance of the class.
Just like outside the class you use the variable name and the "." operator to interact with the class, inside the class you can use the "this" to interact with the class.
|
|
|
|
|
There is no instance associated with a static keyword. Thus using this makes no sense.
|
|
|
|
|
a class can be seen as a template to create objects with. Your class Car eg can have multiple instances like this:
Car lamborghini = new Car();
Car ferrari = new Car():
if you declare a normal variabel like color eg. you can assign a different color to each instance you created.
Car lamborghini = new Car("pitch black");
Car ferrari = new Car("pomegranate red"):
lamborghini.color = "Le Mans blue";
ferrari.color = "Purple";
However, if you assign a static variabel (or function) you cannot assign it to one or the other object. Suppose we assign a static variabel type to car and give it the value "vehicle", neither the lamborghini nor ferrari object has that value, it´s the class Car that has that value. That´s why you access it like this:
String cartype = Car.type;
static members are attached to the class, not to the instance of that class. this points the its own instance.
Hope this helps.
(PS: I want against OO rules here to simplify things, but don´t go making things public like that )
|
|
|
|
|
Hello, I'm very new to C# programming, in fact I only started about 3 months ago and have no formal training, only on the job. I have the need to draw a line on a windows form, that follows a moving point. there are actually 2 points I need to follow creating 2 separate lines. below is the code that creates the moving points:
private void timer1_Tick(object sender, EventArgs e)
{
Double X1, Y1, A, B;
int x2, y2, c, d;
X1 = 300 + (708 * (30 - simNumber14.OldValue) / 30);
Y1 = 495 - (354 * simNumber6.OldValue / 31.5);
x2 = (int)X1;
y2 = (int)Y1;
tietrack.Location = new Point(x2, y2);
A = 297 + (711 * (30 - simNumber14.OldValue) / 30);
B = 704 - (158 * (Math.Max((simNumber3.OldValue - 19.49), 0))/ 15);
c = (int)A;
d = (int)B;
tietrack2.Location = new Point(c, d);
}
A timer variable (simNumber14.OldValue) counts down from 30 minutes to 0, and the points move back to their origins and start to track again. At which point the lines they created over the first 30 minutes would be gone and new ones would start. the process would repeat itself as long as it was asked to. I can't imagine it would be that hard, but I'm very new to this.
Thanks
|
|
|
|
|
You just need to override the OnPaint[^] method in your form, and draw the lines between each current point, or set of points as appropriate.
Veni, vidi, abiit domum
|
|
|
|
|
Thanks, but I'm so new to C#, and Visual Studio in general, that I would need a little more detail on how to implement it, and what the specific syntax would be, maybe an example. I have been trying to research what you've said, thanks for pointing me in the right direction.
|
|
|
|
|
Davebandit wrote: Thanks, but I'm so new to C#, and Visual Studio in general, that I would need a little more detail on how to implement it, and what the specific syntax would be, maybe an example. There's a How to[^] on MSDN. It's from a section on graphics programming[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks, I'll take a look at it.
|
|
|
|
|
Davebandit wrote: I'm so new to C#, and Visual Studio in general Then maybe, you would be better spending some time working through some of the basics first to get your brain properly attuned to the C# and .NET concepts. Charles Petzold has written an excellent introductory book, titled .NET Book Zero[^], and MSDN offer a set of useful tutorials[^]. Add to that the wealth of information in the CodeProject articles[^] and you have plenty of help.
Veni, vidi, abiit domum
|
|
|
|
|
I am new to C#. I have in mind a nested class structure. First of all. Is this optimal? Secondly, please could someone provide the coded outline of this structure so that I can work on filling and coding the functions.
class Z
class Y
class X
class V
|
|
|
|
|
I'm really short of time on this task.
The task is to take a csv file.
Process a list of x,y specified coordinate points.
Work out the distance between all these coordinate points.
Print results to file
Ta
|
|
|
|
|
Is this for an interview or something?
|
|
|
|
|
yes. got it in one. 10 years since i coded in C# and I underestimated the task.
|
|
|
|
|
Well, time management is part of the interview process for projects like this. Do you really need me to tell you how you've done on that part?
Nobody is going to do your work for you.
|
|
|
|
|
Member 10266494 wrote: short of time on this task
So you left doing your homework assignment until the last minute and expect us to do it for you?
|
|
|
|
|
I would avoid nested classes whenever I can, but that's just my personal opinion.
|
|
|
|
|
This is the third time you have asked what is basically the same question. Nested classes is not the answer, as you obviously don't understand what they are. Take Pete O'Hanlon's advice and go and work through Charles Petzold's free book. You cannot learn how to write good code by repeating the same question in a forum like this.
Veni, vidi, abiit domum
|
|
|
|
|
I don't know where I made mistake.I checked everything !! but this error happened :
"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"
thank you in advance.
int i = 1;
int RowNo = 0;
int CellNo = 0;
foreach (DataGridViewRow row in Firstdgv.Rows)
{
foreach (DataGridViewCell cell in row.Cells)
{
if (i > Finaldgv.Columns.Count)
break;
Finaldgv.Rows[RowNo].Cells[CellNo].Value = cell.Value;
i++;
CellNo++;
}
RowNo++;
i = 1;
CellNo = 0;
}
|
|
|
|