|
|
Hi,
I don't like to have lots of .jpeg's floating around,
so I would like to neatly tuck them all away into an
ImageList ... but since they are to be used in several
different programs, where do I put them (that is: where do
I put the ImageList) ? - It would be nice to have a
resource file or a .dll where I could access them when
needed, but how ? ... any ideas ?
TIA
- Athos.
PS: Its easy to just put them into every program I make
(into the ImageList), but that would be a huge waste of
space since there are more then 500+ of them and all the
programs that need them are to be in the same package
(meaning they are shiped together) ...
PPS: Still new to the .NET Framework & C#, but I'm getting
there
|
|
|
|
|
Hello,
Check the ImageList wizard in www.codeproject.com
http://www.codeproject.com/useritems/imlmaker.asp
Have fun,
C:\>csc *.cs
Microsoft (R) Visual C# .NET Compiler
error CS2001: Source file 'brains.cs' could not be found
fatal error CS2008: No [brains.cs] specified
C:\>
|
|
|
|
|
Thanx ... that seems like just the thing I need ...
- Athos
|
|
|
|
|
Does this one ring a bell with anyone? I've got a .cs file I'm trying to compile and it's throwing this error.
error CS5001: Program 'C:\mydll.dll' does not have an entry point defined.
Real programmers don't document. If it was hard to write, it should be hard to understand.
|
|
|
|
|
There's no Main() in your program. Either add one, or use /target:library to create a dll
|
|
|
|
|
Hey what's up coders...
Okay I am going through a Hashtable using an enumerator does the size of the key in bytes actually hinder the time it takes to move through them?
Ie. if I use a short as the key m_htTable[short key] or I use a GUID would the key size really matter. I thought it was all done using address based access, meaning when travesing the hashtable a 32bit address is always used not the actual size of the key.
If anyone knows anything about this could they try and give me and idea on what is actually going on.
Thanks...
|
|
|
|
|
The size of the key doesn't matter.
Hashtable stores all of its keys as object references, so they're all the same size. Note that if you're using value types - such as short - they're boxed, and that can have performance implications if you do lots of accesses.
|
|
|
|
|
I am really frustrated here. I'm sure there is a simple answer but I can't see it.
I used VB.NET some time ago to write a web site, this time I thought I'd use C#.
If I want to access an event handler other than the default for a control in VB, I just use the two drop-down lists at the top of the code view. Select the control in the left-hand box, the event in the right hand. The IDE then does all the work for me (besides, the entire workload consists of having a method that "Handles" the event).
In C#, this isn't possible. The only item in the left-hand drop list is the page and the right-hand list only includes methods already coded.
I thought the answer would be to write the code by hand, for example
<br />
private void dgConfirm_EditCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)<br />
{<br />
dgConfirm.EditItemIndex = e.Item.ItemIndex;<br />
dgConfirm.DataBind();<br />
}<br />
But then somewhere I also need to add
<br />
dgConfirm.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(dgConfirm_EditCommand);<br />
This is easy enough in a Windows Form, where I've met the same problem, because I can add it to the constructor. But there is no constructor for a Web Form and the obvious methods (OnInit and InitializeComponent) are entirely within the "Windows Form Designer generated code" region.
I've learned the hard way that editing this is a bad idea.
So that's it, I'm officially out of ideas. Someone must know how to do this... please!!
Paul
|
|
|
|
|
In VS.NET click on the item you wish to add the event for.
Now open up the Properties panel and click the yellow lightning bolt symbol.
Now you should see all the events available, either double-click on the particular event to add a new (empty) event handler or click on the drop-down and choose the event handler you have already created.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Arrgh!
Thankyou James, I've been beating myself up about this most of the afternoon. Don't know why I didn't think of that. *sigh*
Paul
|
|
|
|
|
I am having a problem with serialization and deserialization of classes using the BinaryFormatter. I have two different programs and I want to serialize a class in the Test1 program and transfer it using sockets to the Test2 program and deserialize it into a replica class.
When I attempt to deserialize in the Test2 program, I get the following System.IO.FileNotFoundException:
File or assembly name Test1, or one of its dependencies, was not found.
Here is an example of how I am serializing:
SomeClass sc = new SomeClass();
sc.var1 = 12;
sc.var2 = m_strTemp;
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms,(object)sc);
After receiving buffer of serialized data, here is an example of how I am deserializing:
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream(buffer,0,nBytesRead,true,true);
SomeClass sc = (SomeClass)bf.Deserialize(ms);
What am I doing wrong? How can I deserialize in an entirely different process, in a different program, on a different machine and not receive this error?
Thanks!
Donald
|
|
|
|
|
Classes in .NET are assembly specific, so if you and I both create a class called Foo with the exact same code but you have yours in the assembly donald.dll but mine is in the assembly james.dll they are considered incompatible types if the contents of the two assemblies differ.
The way to get around it is to place the classes that will be shared between the two applications into a separate assembly (class library to use VS.NET terms).
Then the client program and the server program both reference this assembly.
HTH,
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
That works very well... thank you very much!
|
|
|
|
|
Hi,
I did a class: "Cls" that has a function: "Pic" that return some Bitmap.
I did a console application that listening on port 9988 and do the Cls class to Single call remote class.
I create the client as a windows apllication, and add a PictureBox- "ThePic" to the form.
In some event(like button click) I get Cls class from the remote server and call to Pic function that return the Bitmap (I call it obj)
Here is the problem:
If I call to metod: obj.save("c:\\a.bmp") the picture is succesfully save to the hard disk. (obj is the remote object).
But if I write: ThePic.Image= obj I get RemotingException, that say:
"Remoting cannot find field nativeImage on type System.Drawing.Image".
But how is can to be? The object is succesfully get to the client, becuase I can save this bitmap to the disk. but if I pass it to PictureBox I get this Exception.
Please, Do you have some idea for me?
Thank's alot,
Itay
|
|
|
|
|
I need a text compression algorithm (preferable open-source etc.) to compress and decompress a few XML files for my project. Anyone has any sources?
It doesn't have to be in C# but if possible it should be easily ported. I will probably port it (and not use the binary).
|
|
|
|
|
How big are the XML Files?
Is it worth it?
Why do you want to compress?
- for reduced storage? or
- increased transmission speed? or
- encryption?
If you can answer the above questions with some really good reasons, then you can use some sort of "Huffman compression algorithm".
You can create a functions like:
- string compress(string fatstring)
- string decompress(string thinstring)
If you get this working, can you email me a copy.
Thanks. Keep up the good work.
Regards
Wooble
|
|
|
|
|
You'll easily find projects like xmill (AT&T but free) and xmlppm (sourceforge).
Remember that XML compression should be at the transport level, not at the application level. In other words, that's not a problem that on the network stack XML is made binary. But that really hurts if for any app or for the end user XML is not human-readable.
That said, Xml compression is well achieved :
- because, by design, element names and attributes appear many times
- because LOV (List Of Values) may appear many times too (for the exact same reasons than with a SQL join)/
And I swallow a small raisin.
|
|
|
|
|
|
If you right click on a JPEG file and select Properties and select the Summary tab there are descriptions of this file such as Date Taken, Author, Summary. How can I get or set this information for a specific file?
Any help would be good.
Thanks
Brandon
|
|
|
|
|
|
I have tried that. It has basic information like file creation date but does not allow to access other file information.
Thanks
|
|
|
|
|
I believe that information is stored somewhere in the JPEG file and that Windows Explorer is reading that information to populate the fields.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
I am writing a simple remoting server and have a little problem.
everytime I restart the server after it has been used by a client I get the following error.
Only one usage of each socket address (protocol/network address/port) is normally permitted
If I leave the machine for about 5 minutes then the problem goes away.
The server code I am using looks like this...
<br />
TcpServerChannel channel = null ;<br />
try<br />
{<br />
channel = new TcpServerChannel (8088) ;<br />
ChannelServices.RegisterChannel (channel) ;<br />
RemotingConfiguration.RegisterWellKnownServiceType (<br />
typeof (ClassLibrary.Class1), "Hi", WellKnownObjectMode.SingleCall) ;<br />
<br />
System.Console.WriteLine ("Hit <enter> to exit") ;<br />
System.Console.ReadLine () ;<br />
}<br />
catch (System.Exception err)<br />
{<br />
System.Windows.Forms.MessageBox.Show (err.Message) ;<br />
}<br />
finally<br />
{<br />
if (channel != null)<br />
{<br />
ChannelServices.UnregisterChannel (channel) ;<br />
}<br />
}
As far as I can tell the unregister Channel always gets called.
How do I ensure that the channel is released so it can be reused?
Thanks
Stephen
|
|
|
|
|
The channel should get automatically unregistered when you quit the application. Since any port that your process is listening on will be closed when your process terminates.
You say that the problem only occurs after a client has used it, does the problem occur if a client dosen't use it and you restart the server?. If that is the case then the probably lies with the client somehow. Maybe you can post the relevant client code as well.
I had a similar problem once but it was on the Client side, the problem there was that i was showing a messagebox and forgot to close it thus the application never completely terminated and the port remained open.
May the Source be with you
Sonork ID 100.9997 sijinjoseph
|
|
|
|