|
Hi Martin,
Thanks for your prompt reply.
I added the peice of your code in my customized datagrid class which inherits from DataGrid.
Now it throws me the following errors
The name '_OnPaint' does not exist in the class or namespace CustomControl.CustomGrid.CustomDataGrid'
CustomControl.CustomGrid.CustomDataGrid.OnPaintDelegate' denotes a 'class' which is not valid in the given context
This might be a stupid thing i am asking. The delegate needs to be wrapped with the method. Where do i need to assign the method for it?
Thanks in advance
Regards,
Kais
|
|
|
|
|
Sorry,
Was my mistake!
private delegate void get_DataGridRowsDelegate(..., ..., ..., ...);
protected override void get_DataGridRows(..., ..., ..., ...)
{
if(InvokeRequired)
{
get_DataGridRowsDelegate(new get_DataGridRowsDelegate(get_DataGridRows), new object [] { ..., ..., ..., ..., } );
return;
}
//Your code
}
The method has to be your get_DataGridRows Method you asked for. With all the parameters you had.
If its not working, please post the code here!
Martin
-- modified at 8:08 Monday 3rd July, 2006
|
|
|
|
|
Was a little confused before.
I mixed my code to yours and forgot your actual question.
|
|
|
|
|
Martin,
Thats ok. But get_DataGridRows method is not available for override. How will this work?
Regards,
Kais
|
|
|
|
|
In your case, you can create Method like you had before.
private void get_DataGridRows(...... ;
just insert code in your Method.
Martin
Please give me feedback, if it works.
|
|
|
|
|
Again, it was code from my project.
|
|
|
|
|
Ok let me try out.
I need to leave for the day now.
Catch you tomorrow..
Thank you very much for your suggestion and time.
Regards,
Kais
|
|
|
|
|
hi Martin,
In meanwhile is it possible for you to send me the complete sample code.
I would be very greatful for you if i can get the sample code.
Thanks for all your help
Regards
Kais
|
|
|
|
|
Hello All,
We are using a third parties VB6 object resource file with icons, bitmaps, and text. Ours is completely C# and we are having trouble converting from stdole.stdpicture to C# Image. In VB6 we can access everything fine. In C# we can get the text and the bitmap to convert perfectly but the icons are giving us trouble. The VB method returns a stdpicture object and we use the System.Windows.Forms.AxHost.GetPictureFromIPicture perfectly with the bitmap but we get an error with the icons. Even though the vb method returns a stdpicture C# sees it as an icon and I know of no equivalent to GetPictureFromIPicture for icons. The error is "Unable to cast object of type 'System.Drawing.Icon' to type 'System.Drawing.Image'."
Any way around this would be greatly appreciated.
|
|
|
|
|
After using Google to search for "Converting System.Drawing.Icon to System.Drawing.Image" I found this link in about 2 minutes.
Microsoft Article[^]
It is MS -- so it is VB crap. But it should get you started.
|
|
|
|
|
I guess I wasn't clear. This is exactly what we are trying but the incoming Ipicture is seen in VS2005 as an Icon and bombs when you reach the GetPictureFromIPicture with the error mentioned originally. The one difference we are doing from the samples like the one you provided is we are using stdole.StdPicture as that is what the vb object returns so we can't use stdole.IPictureDisp. I am currently writing a quick project in 2003 to see if it is a VS2005 bug. Our other thought is to write a vb object that takes the stdPicture from the 3rd party dll turn it into something else then pass it along to C#. What a pain though.
|
|
|
|
|
How to subtract 7 days from current date in c#.
Prya
|
|
|
|
|
Use TimeSpan class
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
DateTime curDate = DateTime.Now;
TimeSpan DaysSpan= new TimeSpan(7, 0, 0, 0);
DateTime resultDate = curDate.Subtract(DaysSpan);
Test ONE
|
|
|
|
|
DateTime sevendaysago = DateTime.Now.AddDays(-7);
|
|
|
|
|
See following :
http://pinvoke.net/default.aspx/kernel32.SetLocalTime
|
|
|
|
|
So this is probably a dumb question, but I'm new to network programming and just trying to figure out all the details...
I've been messing around with settings up a Server/Client application, using the TcpClient and TcpListener objects. These are nice and easy, but how do I communicate outside of my local network? For instance, how do I start a server on a computer on my network with a router assigned address (ie. 192.168.X.XXX) and have someone else connect to it from another location? I can't just give them the 192.168.X.XXX address to type in for their TcpClient... so how do I establish a connection, or can I? Do I just need to have a server that isn't connected to the internet by a router?
Basically I want to so something similar to what a game server would do... start up a game and act as the server, have people connect to it, transfer some data, then shut everything down. Is there just another way to obtain an address that will properly resolve to my server if it's on a router?
Thanks in advance...
|
|
|
|
|
You must use port forwarding in the router. Just set port forwarding to IP 192.168.X.XXX and enter the port number you want (intern and extern).
|
|
|
|
|
Hey thanks... that was the missing piece! Direct and helpful. Now I know...
|
|
|
|
|
Has anyone done this with C# before?
|
|
|
|
|
devfendar wrote: Has anyone done this with C# before?
Replicate what?
|
|
|
|
|
What do you mean here ?
If you're asking about creating a copy of the existing object - have a look at the IClonable interface.
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
|
|
|
|
|
|
I found a quine by Peter Gfader[^], that I of course had to improve upon...
using System; class MainApp { public static void Main() { char q=(char)34;string var=System.Text.Encoding.ASCII.GetString(new byte[]{115,116,114,105,110,103,32,98,61});char s=';';string a="using System; class MainApp { public static void Main() { char q=(char)34;string var=System.Text.Encoding.ASCII.GetString(new byte[]{115,116,114,105,110,103,32,98,61});char s=';';string a=";string b="Console.WriteLine(a+q+a+q+s+var+q+b+q+s+b); } }";Console.WriteLine(a+q+a+q+s+var+q+b+q+s+b); } }
---
b { font-weight: normal; }
|
|
|
|
|
public class MyClass : ICloneable
{
public object Clone()
{
return (object)this;
}
}
|
|
|
|