Click here to Skip to main content
15,920,438 members
Home / Discussions / C#
   

C#

 
GeneralRe: Custom cursor as resource Pin
[Marc]26-Jul-05 8:37
[Marc]26-Jul-05 8:37 
GeneralRe: Custom cursor as resource Pin
Will L Pittenger26-Jul-05 13:18
Will L Pittenger26-Jul-05 13:18 
GeneralRe: Custom cursor as resource Pin
[Marc]26-Jul-05 14:11
[Marc]26-Jul-05 14:11 
GeneralRe: Custom cursor as resource Pin
Will L Pittenger27-Jul-05 7:18
Will L Pittenger27-Jul-05 7:18 
GeneralRe: Custom cursor as resource Pin
[Marc]27-Jul-05 8:21
[Marc]27-Jul-05 8:21 
GeneralRe: Custom cursor as resource Pin
Will L Pittenger27-Jul-05 10:02
Will L Pittenger27-Jul-05 10:02 
GeneralRe: Custom cursor as resource Pin
[Marc]27-Jul-05 10:50
[Marc]27-Jul-05 10:50 
GeneralRe: Custom cursor as resource Pin
Will L Pittenger27-Jul-05 17:44
Will L Pittenger27-Jul-05 17:44 
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. Big Grin | :-D 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. Roll eyes | :rolleyes: )

Big Grin | :-D Thank you for your help. Big Grin | :-D Blush | :O 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
GeneralRe: Custom cursor as resource Pin
[Marc]27-Jul-05 20:12
[Marc]27-Jul-05 20:12 
GeneralMemory Leak Pin
dbetting26-Jul-05 6:06
dbetting26-Jul-05 6:06 
GeneralRe: Memory Leak Pin
Steve Maier26-Jul-05 7:18
professionalSteve Maier26-Jul-05 7:18 
GeneralRe: Memory Leak Pin
S. Senthil Kumar26-Jul-05 7:43
S. Senthil Kumar26-Jul-05 7:43 
GeneralRe: Memory Leak [EDITED] Pin
Dave Kreskowiak26-Jul-05 10:14
mveDave Kreskowiak26-Jul-05 10:14 
GeneralRe: Memory Leak [EDITED] Pin
Dan Neely27-Jul-05 2:52
Dan Neely27-Jul-05 2:52 
GeneralRe: Memory Leak [EDITED] Pin
Dave Kreskowiak27-Jul-05 6:33
mveDave Kreskowiak27-Jul-05 6:33 
QuestionHow to Convert Microsoft Excel sheet data into XML data Pin
dsrao26-Jul-05 5:58
dsrao26-Jul-05 5:58 
AnswerRe: How to Convert Microsoft Excel sheet data into XML data Pin
Dan Neely26-Jul-05 6:51
Dan Neely26-Jul-05 6:51 
GeneralPasing messages in remoting Pin
machocr26-Jul-05 5:25
machocr26-Jul-05 5:25 
QuestionHow to serialize/deserialize tree-like object? Pin
soniko26-Jul-05 5:13
soniko26-Jul-05 5:13 
GeneralDataGrid easy question Pin
zaboboa26-Jul-05 4:40
zaboboa26-Jul-05 4:40 
GeneralNon-Standard port configuration for SmtpMail Pin
WetRivrRat26-Jul-05 4:35
WetRivrRat26-Jul-05 4:35 
GeneralRe: Non-Standard port configuration for SmtpMail Pin
S. Senthil Kumar26-Jul-05 5:13
S. Senthil Kumar26-Jul-05 5:13 
GeneralRe: Non-Standard port configuration for SmtpMail Pin
WetRivrRat26-Jul-05 5:48
WetRivrRat26-Jul-05 5:48 
GeneralRe: Non-Standard port configuration for SmtpMail Pin
S. Senthil Kumar26-Jul-05 6:35
S. Senthil Kumar26-Jul-05 6:35 
GeneralRe: Non-Standard port configuration for SmtpMail Pin
S. Senthil Kumar26-Jul-05 6:36
S. Senthil Kumar26-Jul-05 6:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.