|
Normally, I'd agree with you. But in this case, both Pete and RMC told the user to post the question to a different forum, and they obviously didn't notice the "delete" button on the old messages.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
When a file is sent to print in printer++ (a open source virtual printer, developed in c#.net), I want to get the full file name with its full physical path of that file in my c# winform app. Means I want to create a copy of these file(s) that are printed by printer++.
Actually I don't need print, i need copy that image to another location using my winform app. The scenario is when a user print any image with printer++ then my app (it will be installed with printer++ on users pc) automatically get that image and keep a copy in a folder.
These Files should be images like *.png, *.gif, *.jpg etc.
how I do this. Any suggestions for doing this in C#.Net.
|
|
|
|
|
Look at the source code for printer++, and see how it saves and manages the path as it is printing.
|
|
|
|
|
Can you help me to find solution from printer++ source? I searched but not any luck
modified 29-May-14 6:59am.
|
|
|
|
|
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[^]
|
|
|
|