|
It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to VWorker.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Sorry, but I have no knowledge of this product. If it is open source then it's up to you to figure out how it works and modify it as required.
|
|
|
|
|
Thank you Richard MacCutchan for your kind reply.
|
|
|
|
|
Hi, I have a project that required me to integrate VLC video player into my c# program.
I managed to have the following functions play, pause, stop, load, fast forward in the program. But one function that I have no idea on how to implement is the 'Bookmark' function which means when the video is play at some point of time when I add a bookmark on the specified time, it will automatically save into a box and when I press the bookmark it will bring me back to the time where I have bookmark on it.
Please advise if someone has done this before. Thanks in advance.
|
|
|
|
|
I try to create a form with 2 constructors.
The first constructor takes no parameters. User will give their input manually.
The second constructor has parameters. Some ui-controls are filled with data from a database.
I want the second constructor to call the first (or default) constructor for initialisation purposes. How can I do that ?
Public class something
{
Public Something()
{
Backcolor = clgreen;
}
Public Something(string name)
{
Label.text = name
}
}
I used to write code in Delphi, which uses the keyword "inherited" to do this.
I found this article on code project, that is doing the opposite. I have no clue why a default constructor would call the more complex constructor.
How to call an overloaded constructors in C#[^]
|
|
|
|
|
public class Something
{
public Something()
{
Backcolor = clgreen;
}
public Something(string name)
: this()
{
Label.text = name
}
}
A positive attitude may not solve every problem, but it will annoy enough people to be worth the effort.
modified 28-May-14 17:14pm.
|
|
|
|
|
wow, I didn't expect it to be that simple.
In the article the first constructor is calling the second constructor and the second constructor is calling the third constructor.
namespace Dummy
{
public class Something
{
private string myName;
private int myIndex;
public Something()
{
myName = "default";
myIndex = -1;
DoStuff();
}
public Something(string name)
{
myName = name;
myIndex= -1;
DoStuff();
}
public Something(string name, index)
{
myName = name;
myIndex= index;
DoStuff();
}
private void DoStuff()
{
}
}
This is the other way around.
Instead of doing most of the initializing in the first constructor. In the article all initialisation is done in the third (last) constructor.
Which one is the better way to develop.
|
|
|
|
|
Well, you can seriously simplify your logic here:
namespace Dummy
{
public class Something
{
private string myName;
private int myIndex;
public Something() : this("default", -1)
{
}
public Something(string name): this(name, -1)
{
}
public Something(string name, index)
{
myName = name;
myIndex= index;
DoStuff();
}
private void DoStuff()
{
}
} As the three constructors are doing the same thing, with the first two providing default values, simply adding the logic into the final constructor makes things simpler. This example is no longer violating the DRY principle (Don't Repeat Yourself).
|
|
|
|
|
sneezesnoeze wrote: I have no clue why a default constructor would call the more complex constructor. Because someone created a named Something, or because another constructor points to it.
using System;
using System.Windows.Forms;
using System.Drawing;
namespace ConsoleApplication1084
{
class Program
{
public class something
{
Color _backColor;
public something()
{
Console.WriteLine("Fiiiiiiiiiiiiirst!");
}
public something(string name): this (name, Color.Green)
{
Console.WriteLine(string.Format("Name = {0}", name));
}
public something(string name, Color backColor): this()
{
_backColor = Color.Green;
Console.WriteLine(string.Format("Name = {0}", name));
Console.WriteLine(string.Format("Color = {0}", _backColor));
}
}
static void Main()
{
new something("Hello world");
Console.ReadLine();
}
}
}
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
sneezesnoeze wrote: I have no clue why a default constructor would call the more complex constructor.
Surprisingly, this is common and reasonable.
This is to accomplish providing default values for the various parameters of the complex constructor.
See section "10.11.6 Optional instance constructor parameters" of the : C# Language Specification[^]
Starting with C# 4.0 optional arguments (see C# Language Features, From C# 2.0 to 4.0[^]) provides this capability if the default values are constant value expressions (or new S() or default(S) where S is a value type):
See section "10.6.1 Method parameters" of the C# Language Specification (linked above).
A positive attitude may not solve every problem, but it will annoy enough people to be worth the effort.
|
|
|
|
|
There's two ways to write this:
public class Option1 {
public Option1() : this(name) {}
public Option1(string name) {
Label.Text = name;
BackColor = Color.Green;
}
}
or
public class Option2 {
public Option2() : this(name) {
BackColor = Color.Green;
}
public Option2(string name) : this() {
Label.Text = name;
}
}
There is no functional difference between these two, it's a matter of style. I normally prefer the first option (calling the more complex constructor with default arguments) because that way all the initialisation is in one place and it's easy to confirm that you have set everything you meant to.
|
|
|
|
|
|
Hi every1. This is my first post so be gentle
I want to make ,a song organizer connected with database(sql).
So basicaly windows app with option for just inserting my favorite song names with artist/genre selection thats it..
Any similar tutorial step by step or so? Im new into c# but don't know how to start.. Help plz
|
|
|
|
|
Search around for tutorials, pick the one that uses books as a subject (assuming there is not one based on songs).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello.
I am working on Windows Forms Application project (it is assignment). End this is how form should look: http://postimg.org/image/ywkeyuc5f/[^]
I need to write method that when I click on Add button textboxes should be erased (so the new value which user add could be accepted).
Any suggestions?
|
|
|
|
|
Vexy wrote: Any suggestions? Try looping all the controls, and check if it's a textbox. If yes, set the Text property to nothing.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
..the buttons, the textboxes, the labels; all the stuff on the form. What UI are you targetting? WPF, WinForms, or ASP.NET?WinForms, as stated in the original post!
Your form is a container that contains a collection of different controls[^]. There's some textboxes and some buttons on your form.
If you loop over that collection (foreach), then you can inspect all the elements on a form. You can also ask a control whether it is of a specific type. If it is of the TextBox type, then cast it to one and change it's value.
If any of above three lines sound weird then we'll expand on them
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
modified 28-May-14 14:26pm.
|
|
|
|
|
There are many ways you could accomplish this, ranging from the extremely simple through to just the simple. If you're just looking to set those three TextBox controls to be empty, then the quickest way is just to explicitly set the Text property to string.Empty for each one. So, suppose you had txtForename, txtSurname and txtAge as the three TextBox es, simply do this in the event handler for the add button:
txtForename.Text = string.Empty;
txtSurname.Text = string.Empty;
txtAge.Text = string.Empty; Now, you could accomplish this by looping through all the controls on the form, and loop through all the child controls as well, looking for TextBox es, but I would stick with the simple version if I were you. Fancier implementations really are a case of YAGNI for your assignment.
|
|
|
|
|
Thank you VERY MUCH for detailed answer. I will try to do like this.
Best regards!
|
|
|
|
|
KISS. The acronym, not the action.
+5
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
you can do that by calling a function which fill the text boxes when the edit button clicked and filling the boxes when add new value button called.
Hint: use a flag to know the order type.
Osama M.Shatnawe
|
|
|
|
|
Dear reader,
at startup of my program I want to find all instances/classes, which support an special interface.
Example:
I have class A, which supports interface "void someFct()"
I have class B, which supports interface "void someFct()"
At startup of my program, I want to call both functions/interfaces without registering them before.
I hope you can understand, what I want?
Have a nice day
############### update ########################
I try to describe my problem better
My app reads a lot of data-sources and then it executes a list of ReportInstances, where each report creates excel-reports/sheets. This takes roughly 10 minutes. Each individual report checks/validates its input/config/... before it executes its own business-logic. In practice it happens, that in worst case the last report detects an error at its validation and the program stops. This is very annoying.
Simplyfied code here:
<pre>void CreateReport( params here ) {
CreateReport_1(par);
CreateReport_2(par);
.......
}
My idea is: Do validation, before starting the single reports
Solution 1: Register all validation-delegates and execute them before starting the reports
This kind of code is
void CreateReport( some params ) {
myValidationList.Add( Reporter_1.GetValidationDelegate());
myValidationList.Add( Reporter_2.GetValidationDelegate());
foreach (validationDelegate in myValidationList) {
execute validationDelegate;
}
CreateReport_1(par);
CreateReport_2(par);
.....
}
This is easy, but it has the disadvantage, that each time I add a new reporter I have to change my "registration-code". It is some kind of maintenance problem.
Solution 2: Do it "more automatic", this is what I am looking for
The kind of code I am looking for is
void CreateReport( some params ) {
myValidationList = GetAllAvailableValidationDelegates()
foreach (validationDelegate in myValidationList) {
execute validationDelegate;
}
CreateReport_1(par);
.....
}
I am looking for the code of "GetAllAvailableValidationDelegates()", which "parses" automatically all available classes/instances in my program and looks for such delegates
modified 29-May-14 0:00am.
|
|
|
|
|
|
I think learning MEF[^] can help you...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|