|
Thank you Christian.
Christian Graus wrote: you need to write code to conforms to what IE expects.
It is my problem exactly
Can you help me ?
Freshman
|
|
|
|
|
A quick google leads me to believe that IE has a drop event handler, so if you had IE in your own window, as a control, you could handle it. I don't see anyting else, but if you try to google it, you may find something.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
OK, Thanks
Freshman
modified on Sunday, June 22, 2008 6:54 PM
|
|
|
|
|
OK, i finally got it. IE expects Files (which we already knew right?). After a little investigation it turns out the a FileDrop is just an array of strings (usualy with just one string in, go figure).
So, simple enough:
void TreeView1ItemDrag(object sender, ItemDragEventArgs e)
{
string[] stuff = new string[1];
stuff[0] = @"http://www.google.co.uk";
.
DataObject data = new DataObject(DataFormats.FileDrop, stuff);
.
this.treeView1.DoDragDrop(data, DragDropEffects.Copy);
}
So, IE will get this info, check the array of strings for the file to open, find your web address, and open it.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Well figured out SK Genius. This could be a useful find
Dave
|
|
|
|
|
Hello,
I am presently creating a list box control for our custom gui application using C# .
The dll is compiled using 1.1 compact framework SDK and is run on windows XP/CE embedded..
The new list box control has to be modified to use custom graphics.. the requirement right now is to replace the windows standard scroll box with the custom images provided..however since we are using compact SDK many of the properties related to the scroll box are not available. Does anyone have an idea a work around .
Regards
Vivian Neil Fernandes
|
|
|
|
|
Don't cross post. It's considered rude and isn't going to help you get an answer any faster. The original message is here[^].
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Hi.
I'm having trouble with a DataGridView. The view displays a list of customers from a query that displays their relevant ID's and names which is bound to a DataTable. When the user double clicks on the customer they want, I would like to get the customer ID of their selection.
I've tried customerDataGrid.SelectedRows(0).Cells(0).Value but I get an error saying that SelectedRows is a property but it is being used as a method.
How do I achieve this. I know it is probably simple but I cannot find the info that I need on MSDN and I am at a loss. Your help is much appreciated in advance.
The FoZ
|
|
|
|
|
TheFoZ wrote: but I get an error saying that SelectedRows is a property but it is being used as a method.
Yeah, because that's what it is.
customerDataGrid.SelectedRows[0].Cells[0].Value
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Looks like I'm still in my VB ways with curved brackets instead of square ones.
Many Thanks
The FoZ
|
|
|
|
|
hey there also you should keep in mind that it is posible to have more than one selected row in a dataGridView unless otherwise set up by you in design time.
if thats desired youll have to do the following...
foreach(DataGridRow myRow in myDataGrid.Rows)
{
}
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Thanks for that. It will come in use later on in the project.
The FoZ
|
|
|
|
|
HarveySaayman wrote: posible to have more than one selected row in a dataGridView unless otherwise set up by you in design time
Yes. You can use datagridview1.MultiSelect=false for only allowing one. Brought this up to my students the other day in class.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi, as you might know from an older post (here) I'm working on a communication protocol driver in C#.
Protocol messages can be of two types (commands and responses) so I chose the following class structure:
public abstract class Message
{
protected byte[] CompileCommonPacketPart()
{
}
}
public abstract class Command : Message
{
protected byte[] CompileCommandPacketPart()
{
}
}
public abstract class Response : Message
{
protected byte[] CompileResponsePacketPart()
{
}
}
public class MyCommand : Command
{
public byte[] CompilePacket()
{
CompileCommonPacketPart();
CompileCommandPacketPart();
...
}
}
As you see, at the moment CompilePacket() explicitly includes calls to the base methods in order to compile the generic parts of the packet, and every time I define a new command I must manually insert these calls.
This could be error-prone (I have to deal with a lot of commands...) and I feel that there should be a way to factor out this common behaviour...
Is there any way to perform these calls automatically (not explicitly)?
Thanks in advance for your support!
Andrea
|
|
|
|
|
Yes, it can be error-prone, but there isn't a way to automatically call the base class methods. You could implement a virtual method on Command that handles this for you and then in the derived classes override that method instead. It would make your classes look like this:
public abstract class Command : Message
{
protected byte[] CompileCommandPacketPart()
{
}
public virtual byte[] CompilePacket()
{
CompileCommonPacketPart();
CompileCommandPacketPart();
}
}
public class MyCommand : Command
{
public override byte[] CompilePacket()
{
base.CompilePacket();
}
} This simplifies things a bit in that you only have to call base.CompilePacket() . Thinking about it a bit more, you might be able to do this:
public abstract class Command : Message
{
protected byte[] CompileCommandPacketPartInternal()
{
}
protected abstract byte[] CompileCommandPacketPart()
{
}
protected byte[] CompilePacket()
{
CompileCommonPacketPart();
CompileCommandPacketPartInternal();
CompileCommandPacketPart();
}
}
public class MyCommand : Command
{
public override byte[] CompileCommandPacketPart()
{
} This will work as long as the order of calls in Command.CompilePacket() will always be the same. In either case, you might want to make some of the protected methods internal or private instead.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
As Scott already said, there's no way to automatically call a base class method. One solution would be to use some kind of hierarchy, in case the methods are always called in the same order:
public abstract class Message
{
protected virtual byte[] CompilePacket()
{
}
}
public abstract class Command : Message
{
protected override byte[] CompilePacket()
{
base.CompilePacket();
}
}
public abstract class Response : Message
{
protected override byte[] CompilePacket()
{
base.CompilePacket();
}
}
public class MyCommand : Command
{
public byte[] CompileCustomPacket()
{
base.CompilePacket();
}
}
So you will only have to call base.CompilePacket() , everything else will be handled by the inheritance hierarchy.
regards
modified on Sunday, June 22, 2008 2:15 PM
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Would the "Template Method" design pattern work?
public abstract class Message
{
public byte[] CompilePacket()
{
CompileCommonPacketPart();
CompileCommandPacketPart();
CompilePacketInternal();
}
protected abstract byte[] CompilePacketInternal();
}
public class MyCommand : Command
{
protected override byte[] CompilePacketInternal() {}
}
|
|
|
|
|
Publicly expose the base method only. Have the base method call a protected [pure] virtual method. The derived classes now implement the latter method, not the first.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I'd like to thank everybody, now I have a whole bunch of new ideas to try out!
Best regards,
Andrea
|
|
|
|
|
HI,
I'm New To All System.Reflection Area
is there a Way To Get ClassInfo From a DLL
Where There Are Some Classes.
Have Fun
Never forget it
|
|
|
|
|
By using System.Reflection namespace, you can get various information about an assembly. You can;
- Get the class names in that assembly
- Get the function names in a class
- Get the Parameter info of a function
Here are some code samples to do the things above:
To load an assembly dynamically:
Assembly MyAssembly = Assembly.LoadFile(Application.StartupPath + "\\MyDll.dll");
To get the class names in an assembly:
Type[] myClasses;
myClasses = MyAssembly.GetTypes();
To get the function names in a class:
MethodInfo[] mi;
mi = myClasses[i].GetMethods();
To get the parameter information of a specific function in a class:
ParameterInfo[] pi;
pi = mi[i].GetParameters();
Regards
Zafer SAVAS
|
|
|
|
|
Just as a note, MyAssembly.GetTypes() does not just return classes, but also interfaces, enumerations, etc. If a Type represents a class, it will have the IsClass property set to true
|
|
|
|
|
|
Hi there.
Firefox browser saves site's icon into the base64 string in its bookmark HTML file.
Like this :
<A HREF="http://en-us.www.mozilla.com/en-US/"
ADD_DATE="1183006386" LAST_MODIFIED="1212431053"
ICON_URI="http://en-us.www.mozilla.com/favicon.ico" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/
9hAAABEUlEQVQ4jbWSsXEDMQwEL0CIWAWwBdTCFtgCU0Xs4bMPVAgL+GZUwTrg/
5uS7JECGwlnOLzF4UDpr6u1RkqJkIgIWmv03nkrvN/vRAQhsUks+1mkAZN+B63
rDTOj7MIicZUgxlkkUkq4+88AMzsB7J23GLCrxKYg50xKiUXiRdxaw8xYdgD67
nyAmOBlHgfA3cfsMR7NggN2ZHLcLftYp4Pn7jMgJNydnPOjkwgEnGtbJsH1CXh
sotZKiTjDlpnRe8fdT9E2Cee7I5daKwpRShkOzAx3f5l9k7hcLoREzplaK4uCC
LGuNx620Ht/sb5Ntt/+xFor8Zx87El/Ur13Yg9n7p5z/gwwg47w3H0E9Z/1BfA
kJDRE3FKkAAAAAElFTkSuQmCC" SHORTCUTURL="mozila"
LAST_CHARSET="UTF-8">Mozilla - Home</A>
Now, I want convert it to an image.
for this, first I omitted data:image/png;base64, and other needless strings , then I used this method :
private Image Base64StringToImage(string base64ImageString)
{
byte[] b;
b = Convert.FromBase64String(base64ImageString);
MemoryStream ms = new System.IO.MemoryStream(b);
Image img = System.Drawing.Image.FromStream(ms);
return img;
}
But this Exception occurred :
Invalid length for a Base-64 char array
Can you help me ?
Sorry for my English. I'm a freshman .
|
|
|
|
|
Works for me with the string given (it's a 16x16 icon with the red mozilla dragon head). Maybe you accidentally include some carriage returns or line feeds in the base64 string?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|