|
I have no idea what you mean. Do you want to write a windows hook so you capture events outside your program ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Is it compulsary to have a abstract method in abstract class?
Ravi
|
|
|
|
|
hi,
Good Morning,
it is not compulsory to have abstract method in abstract Class;
check with this example and give reply
public abstract class TestClass
{
public void display()
{
System.Console.WriteLine("Hello World");
System.Console.Read();
}
}
class SampleTest: TestClass
{
public static void Main(string[] args)
{
//TestClass t1 = new TestClass();
SampleTest s = new SampleTest();
s.display();
}
}
WIINING IS NOT OUR DREAM,IT'S A HABIT
HAVE A NICE DAY
|
|
|
|
|
Thanks its working without an abstract method
|
|
|
|
|
hi All,
I want to known when we go for Abstract and Interface concepts,
What are the features of Interfaces,
How it is differ from ABstract.
Pls give clarification.
Have a nice day
|
|
|
|
|
Dronala,
Abstract classes can have definitions for some of the methods while interface will never have a definition for any method. By default all members in interface are public and you can not modify it. In abstract class this is not the case. You can have any type of access modifier. You can use abstract class where you would like to provide definition for some method in base class itself and those should not be changed by its Childs. You can use interfaces if you want to implement more than one interface and give flexibility to the implementer to decide the behavior of all methods.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
I think this is going to be a hard one...I am using C#
I have this in each of my control's MouseDown and MouseMove events:
Private int Ox , Oy ;
Private Sub BackDiag_MouseDown(object sender, MouseEventArgs e)
{
Ox = e.X;
Oy = e.Y;
}
Private Sub BackDiag_MouseMove(object sender, MouseEventArgs e)
{
ControlName.Left = ControlName.Left + (e.X - Ox);
ControlName.Top = ControlName.Top + (e.Y - Oy);
}
I can click on any control with that code and move it around at run time and it works great. Now I want to be able to select multiple controls on my form at runtime and move them in the same manner. The ideal solution would be to be able to select them as a group by drawing a square around them with the mouse (like you do when selecting multiple icons on your desktop) and also be able to add to the selection 1 at a time by holding down ctrl and clicking on them with the mouse (also like you do with icons on the desktop) and move them around as a group. That may be asking to much, so if I can't have it that way, then 1 or the other will work.
If you have any questions, please ask.
Arjun Munda
|
|
|
|
|
Hi All,
I am trying to dynamically create object based on values that being submited from a form, but keep on getting a "No parameterless constructor defined for this object." error.
<br />
Type paramType = Type.GetType("System." + Request["type"]);
String paramValue = Request["val"];
<br />
if (paramType != null)<br />
{<br />
Activator.CreateInstance(paramType);<br />
}<br />
|
|
|
|
|
What are the types that you are trying to create, and do they all have public, parameterless constructors?
-Phil
|
|
|
|
|
Hi Phil,
Right now I am just trying to create strings and ints, but will have to create other types of objects. All will be public but some will be parameterless constructors some will not.
Thanks,
tom
|
|
|
|
|
The System.String type does not have a parameterless constructor (they all require at least one parameter), and therefore cannot be instantiated via the Activator.CreateInstance(Type) method.
-Phil
|
|
|
|
|
thanks Phil,
Would you mind showing me a quick example of how to create a string via reflection. This is what I tried using before but it allways returns null.
<br />
Type[] ArgTypes = new Type[1] {Type.GetType("System.String") };<br />
ConstructorInfo oConstructorInfo = paramType.GetConstructor(ArgTypes );<br />
thanks
|
|
|
|
|
Here's one way to create the string "a" via reflection:
<br />
Type type = Type.GetType("System.String");<br />
<br />
object obj = Activator.CreateInstance(type, 'a', 1);<br />
In this case, the .NET runtime would use the System.String.String(char, int) constructor in order to create the instance because we passed a character and an integer to Activator.CreateInstance().
In the case of the .NET native types like strings and integers, however, if you already know what the value of the object will be, using reflection is overkill. There are far easier ways to translate between one native type and another.
-Phil
|
|
|
|
|
You could Create a class called MyString
add a parameterless constructor and an implicit cast
public static implicit operator string (MyString A)
{
return A._internalStringVariable;
}
public static implicit operator MyString (String S)
{
return new MyString(S);
}
Then you'll have an object that behaves a bit like a string but has a parameterless constructor.
HTH
Russ
|
|
|
|
|
Hi,
As part of the application I am working on, I would like to allow the application to dial up to the closest regional office. Our company has servers in every major city in the US so basically the only thing that I need to change is the phone number of the dial-up connection that the application is using.
I have managed to connect/disconnect using an unmanaged c++ code that is based on WinINet(InternetDial, dll or using RASDial. The problem with RasDial is that it's not reliable (At least from my experience...) and the problem with the c++ function that I am using is that it doesn't let me specify the phone number...
At this point, the only option that might be viable is to use RasDialDlg. Has anyone ever tried to use this function with c#? If yes, do you have any code samples or tips you can share with me?
Regards,
Joe
|
|
|
|
|
Hi,
I am trying to develop a webservice which will scan a given directory on the server and expose the result. I want to call this webservice from a WinForm application to populate a treeview.
Do you have any suggestions on the way I should do that ?
Thanks,
Guillaume
|
|
|
|
|
Hi,
Not sure what part you need help with, but the easiest way to consume a webserivice is build a proxy class in vs.net. Just right click on the name of your project in the soloutions explorer and the select add webreference. Then enter the url to the WSDL of your webservice and click on the add web reference button. You can then call the methods of your webservice by doiing th following.
webreferenceNameyoucreatedabove.methodName();
Regards,
tom
|
|
|
|
|
Hello all,
Hopefully someone can help me solve this problem. I'm trying to print a PrintDocument, but I get inconsistent results. Sometimes it works, and sometimes I get "The handle is invalid" or "Incorrect parameter" exceptions. I stripped it down to the following code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Printing;
namespace PrintTest
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
PrintDocument pd = new PrintDocument();
PageSetupDialog psd = new PageSetupDialog();
psd.Document = pd;
if (psd.ShowDialog() == DialogResult.OK)
{
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = pd;
try
{
ppd.ShowDialog();
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Exception");
ppd.Close();
}
}
}
}
}
Thanks in advance!
|
|
|
|
|
I havent had any printing problems, except for the fact that some details are strange at least (where and when to set properties in order to choose color, landscape, duplex...).
But I strongly suggest you throughly process any exception; rather than looking at
exc.Message, you really should look at the multi-line exc.ToString()
it gives you, depending on the kind of exception, much more information, and also
a stack trace, so you can tell in exactly what line things fail.
Good luck !
Luc Pattyn
|
|
|
|
|
try to comment pagesetupdialog object and just try working around with objects printpreviewdialog and printdocument
printPriewdialog ppd = new printpreviewdialog();
ppd.document=pd;
ppd.showDialog();
|
|
|
|
|
Thanks for the reply! If I don't use a PageSetupDialog the problem persists when I actually try to print. Just like before sometimes the document prints and sometimes I get exceptions.
TIA
|
|
|
|
|
I'm still getting exceptions, which actually come from the ShowDialog command. The document is rendered correctly, but if I try to print from the print preview dialog I get an exception.
Thanks in advance for any help on the subject!
|
|
|
|
|
For what it's worth, I think this is a bug somewhere in Microsoft's code. Even if I use the sample code provided on the Microsoft website (http://msdn2.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx) I still get invalid handle exceptions!
|
|
|
|
|
Well, your previous post triggered my memory:
When I earlier said I did not have any printing problems, I was forgotten that I once
had major problems, if clicking the Prin button in the Preview Dialog.
This occurred some 2 years ago, when I added printing capabilities to my major application,
using either .NET 1.0 or 1.1 (without SP), I dont recall.
Since then I have been using my app and have printed and previewed hundreds of pages.
I do not recall what the exact problems were, but I concluded not to use that Print button
anymore.
I should also add I had some dificulties in understanding (or getting to work without
understanding) the printer settings regarding:
- page orientation
- color support
- duplex printing
And finally I have always been puzzled how one is supposed to do a Print Preview without
selecting a printer (with its margins, page orientation, etc). I would find it simpler
to have a print dialog with its normal choices, and both a Preview and a Print button.
Following your input I just finished a couple of experiments, and was unable to make
the Print Button on Print Preview Dialog fail; I have tried .NET 1.1 WITH SP1, as well as
NET 2.0 So maybe there has been a bug and it got fixed either in SP1 or in 2.0
What is your .NET version ? and the one your bug info refers to ?
Luc Pattyn
|
|
|
|
|
My .NET version is 2.0. I'm not sure what you mean when you ask "the one your bug info refers to", as I assume it would be the same. Can you elaborate if this isn't the information your looking for!
Thanks!
|
|
|
|