|
Yeah, i don't know C#, i'm from VB.Net...
Thank God that it's all .Net!
Why don't you try this, it will print all the resources in your app:
String() res = Reflection.Assembly.GetExecutingAssembly.GetManifestResourceNames();
int i;
for (i=0; i<res.Length; i++){
Console.WriteLine(res(i))
}
If movingCol.cur is somewhere in that list, you have to use the entire name in GetCursor (maybe that includes a namespace or something). If you can't find movingCol.cur anywhere in the list, make sure it's an embedded resource (in Solution Explorer: right-click movingCol.cur, Properties, Build Action = Embedded Resource.
Cheers!
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Please do me a favor and pick a language.
Since this does not appear to be what I know of C#, I am noting some comments. Feel free to skip them if you will always use VB in samples. (However, if you continue to assist C# users besides myself, you might want to learn more C#. You would help them out. Many would not know VB. I know a little and can do some translation.)
1. Specifying "String()" is invalid. You are attempting to declare a function named String with an unknown return type and no parameters. Since you mentioned System.Reflection.Assembly.GetEntryAssembly() (minus the System part), I looked up that function and found it returned an array of strings. The C# syntax for that is "string[]".
2. You did not complete the for's condition or increment clauses. You also could have declared "i" inside the for. Hence, that could have looked like "for(int i = 0; i < res.Count; i++)". However, I decided I could skip storing the array and declaring the int by using a foreach statement. See below.
3. Again, you array syntax is VB. "res(i)" should read "res[i]". Remember, C# is highly related to C/C++.
This is the code I came up with:
foreach(string strManifestResourceName in System.Reflection.Assembly.GetEntryAssembly()<br />
.GetManifestResourceNames())<br />
System.Diagnostics.Trace.WriteLine("Found Resource: " + strManifestResourceName);<br />
<br />
System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly()<br />
.GetManifestResourceStream("movingCol.cur");<br />
System.Windows.Forms.Cursor cur = new System.Windows.Forms.Cursor(stream);<br />
stream.Close();<br />
return cur;
That results in this output:
Found Resource: DataListTest.res.movingCol.cur<br />
Found Resource: DataListTest.Form1.resources<br />
Found Resource: DataListTest.dataListHeaderCtrl.resources<br />
Found Resource: DataListTest.dataListCtrl.resources<br />
Found Resource: DataListTest.dataListHeaderCtrlNoChild.resources
I then changed the original code that specified the resource to replace "movingCol.cur" with "DataListTest.res.movingCol.cur". It now loads properly. I have also added code to verify that the cursor is what I want. I may make changes later. I am just getting around to actually needing it. (I was there when I created the cursor, but then I decided to rearrange. Delays. )
Thank you for your help. Sorry if I seemed critical about your C# knowledge, but many C# users may not know VB. They might recognize the function calls, but something like "String()" will confuse C# developers that do not have at least some VB experience. Even then, it took a while for me to figure out what you wanted. I almost asked you to just give me the VB version. Then I noticed parts were VB.
--------------
Will Pittenger
|
|
|
|
|
Well i'm glad it works now!
About the C#:
That is definetly a problem. I know how to read it, but i'm a bitch at writing it... All those { and }, it's driving me mad! I know it looks a lot like C++, but i know even less about that . Anyway, before i post something in this forum again, i'll be sure to rag it through Reflector or something. That always works for me!
Mzl..Marc
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Can someone give me a suggestion? I've tried several different methods of creating this form and destroying it when I am done, all with the same results. This seems to be the cleanest and easiest method to use but it still does not give a good result.
using (frmContainer FrmMP = new frmContainer(null, TFormList.MasterParts, -1))<br />
{<br />
FrmMP.SetSalesOrderInfo(SelectedOrderNumber, SelectedReferenceNumber);<br />
FrmMP.ShowInTaskbar = false;<br />
FrmMP.StartPosition = FormStartPosition.CenterParent;<br />
FrmMP.ShowDialog();<br />
}<br />
Upon opening this window, I've added 3K to my memory. Wouldn't be a problem except it gets called several times per hour. For some people this is 100K per hour. The only way I've been able to actually get the memory collected is by minimizing and then resuming the program. Not very convenient for the user and they don't know when they need to go through that ritual (nor should they).
I've tried several different calls to do garbage collection (even though it is not recommended) but these didn't work either. A session will usually start at about 10K. When it hits a couple hundred K, I can minimize and restore the pgm and it is usually back down to 15-20K. If I do not minimize, it just continues to grow.
Any suggestions?
|
|
|
|
|
I have seen this behavior with just about any Windows program. VS6 was pretty bad, Word, Lotus Notes, and many others. You could try to set your FrmMP = null; I have seen others do that where they were trying to reclaim memory.
Steve Maier, MCSD MCAD
|
|
|
|
|
Where did you see your memory consumption? In the Task Manager?
It's a bad idea to use Task Manager to find the memory used by managed applications. Task Manager reports the total memory consumed by an application. For managed applications, the Garbage Collector manages the heap and it acquires and releases memory from the OS whenever it wants to. In your case, it decided not to release it back, but it eventually will. You can use this[^] to peer into your GC heap, if you're really sure it never releases it back, even when the system runs out of virtual memory.
Or you can use perfmon, with # Bytes in all heaps.
When you minimize your application, all you are doing is minimizing the working set of your process, ie, the pages that are currently in physical memory for the process. It doesn't mean that the application is now consuming lesser memory. If you look into the VM Size column, you'll see that it doesn't change when you minimize or maximize your application.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Whenever you use .ShowDialog() , you MUST call .Dispose() on that form object when your done with it.
Form.ShowDialog()[^] docs.
[EDIT]
Whoops! Didn't see the using statement you had in there...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Something that's not clear from the msdn docs. Will the GC eventually finalize the dialog and reclaim the memory in the indefinite future, or is it as permanantly lost as in unmanaged code.
|
|
|
|
|
It's not really the memory that's the problem, but the unmanaged handle-based resources that the form holds onto. If used frequently enough, and not freed by explicitly calling .Dispose() , they can be exhausted, causing an "Out of memory" exception, even though memory is not what you ran out of. The GC doesn't track handle usage, and so, can't tell when the system is running low. If the GC can't tell this, it can't speed up Disposing and Finalizing the objects it's supposed to collect.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Please help me how to convert Excel sheet data into XML.Here is scenario i have microsoft Excel sheet it contains 5 columns and no of rows.I want show all these data into XML.
Thanks & Regards
Rao
|
|
|
|
|
IF you have office 03 (maybe 02 as well) you can select xml in the saveas dialog.
|
|
|
|
|
Hi, I have a remoting comunication with tcp chanel. I use it to marshal objects.
I want to pass messages from the server to client like events, I suppose that the answer is sink and contexts but I newer in this topics.
I want to send messages in server and catch in client.
It is possible to do that? Where can I find a sample obout that.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
I have class marked for serialization:
[Serializable]
public class DEMO
{
public DEMO[] ChildElements;
}
How can write code for serialization/deserialization in XML for such class? I need the shortest piece of code and without (if possible) manual working with XML nodes.
|
|
|
|
|
Hello,
How come for my DataGrid, every time I fill out a new row, but click away to the rows that were loaded from a dataset, and the new row that I just modified goes away?
Thank you
|
|
|
|
|
Is it possible to configure the SmtpMail.Send(); to send mail from any other port besides port 25? I DO NOT NEED TO RECIEVE AT ANY TIME! Sending mail only. (Auto Response mail generator for a password resetting program.)
Dim Beautiful As String
Beautiful = "ignorant"
Label1.Text = "The world is full of " & Beautiful & " people."
Why is common sense such an un-common comodity?
|
|
|
|
|
No, unless you are running the mail server. All standard mail servers listen on port 25, so I guess that leaves you with no option but to use 25.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I thought that it didn't matter what outgoing port you sent on it would still connect on the proper incomming port. but I guess not?
does that mean that the smtpmail uses the configuration of the local smtp server to send? so if i were to load it on a local client and set the local smtpserver at the non-standard # it would work, but other wise won't?
Dim Beautiful As String
Beautiful = "ignorant"
Label1.Text = "The world is full of " & Beautiful & " people."
Why is common sense such an un-common comodity?
|
|
|
|
|
Sorry, I misread your question. You're right, the outgoing port doesn't matter.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
But you are sending the mail to the mail server listening on port 25, aren't you?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
yes, it should be, i don't know for certain. but even if i send it out on say 26 it should still receive right, if it is recieveing smtp.
in otherwords if i were to send mail on port 80 to mail.blah-blah.com it would know (if the router/firewall it's setup properly)to accept incomming traffic to mail.blah-blah.com on internal port 25 right? so i should be able to send outgoing mail on whatever port i want, as long as the recieveing server is configured to recieve mail from mail.whatever.whatever.
or am i just really off in my thinking here?
Dim Beautiful As String
Beautiful = "ignorant"
Label1.Text = "The world is full of " & Beautiful & " people."
Why is common sense such an un-common comodity?
|
|
|
|
|
wetrivrrat wrote:
were to send mail on port 80 to mail.blah-blah.com
If you meant connecting to mail.blah-blah.com's port 80, no, it wouldn't work. Port 80 is for HTTP, it most certainly won't be expecting SMTP messages there.
So, the answer for your question is, yes, you should use port 25 for sending mails. I got sidetracked because I thought you were talking about the port number of the client which is sending the mail.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
no, I was talking about the outbound port.
But I figured out a way.
It seems it will still send outgoing mail if I relay off another server. So i'm up now.
thanks!
Dim Beautiful As String
Beautiful = "ignorant"
Label1.Text = "The world is full of " & Beautiful & " people."
Why is common sense such an un-common comodity?
|
|
|
|
|
Is it possible to configure the SmtpMail.Send(); to send mail without having to have smtp installed locally?
I need to be able to send mail internally(intra-net) without having to install smtp on every client, as well without having to access the local mail client, as we don't have outlook or outlook express installed on the clients.
We are however in a Novell / Groupwise environment and I don't know anything about how to intergrate with GW, so I would like to stay away from trying to intergrate, but if it is the only way then i'm open to making it work. (I would need some help though!)
Dim Beautiful As String
Beautiful = "ignorant"
Label1.Text = "The world is full of " & Beautiful & " people."
Why is common sense such an un-common comodity?
|
|
|
|
|
Just set the SmtpMail.SmtpServer property to the name of the smtp server you wish to use.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks much!
Dim Beautiful As String
Beautiful = "ignorant"
Label1.Text = "The world is full of " & Beautiful & " people."
Why is common sense such an un-common comodity?
|
|
|
|