|
so i guess no one knows about STA MODE?
|
|
|
|
|
MSDN[^] is your friend...
Regards,
mav
|
|
|
|
|
why would one use this?
seems like only use this if your accessing com objects is this correct?
Thanks in advance
|
|
|
|
|
I'm cross-posting this here since there seems to be a much livelier discussion of interop on this thread than on either the COM or .Net Framework threads. Apologies in advance to any offended parties.
I have a scenario similar to the following:
Assume a single assembly (SomeAssembly.dll) contains the following types:
1. Class B inherits from class A
2. Class A implements properties Moe, Larry and Curly, all of type ArrayList.
3. Class B implements a public interface containing all of the public members of both classes A and B.
The problem:
I export the type library for SomeAssembly.dll using
Regasm.exe SomeAssembly.dll /tlb:SomeAssembly.tlb /codebase
When I view the generated type library, I see that while properties Moe and Larry appear as "Moe" and "Larry" (their proper case is preserved), property Curly is exported as "curly" (all lower case). So far, I haven't been able to find an explanation for this behavior, and while the CCW works just fine, the name change is a little disconcerting for my client.
The only similar article I was able to find referenced a known issue whereby if there was another "curly" property that was written to the type library first, all following same-named properties would bear the lowercase name, but there is only one "Curly" property in my assembly.
Any ideas? Failing a solution, is there any attribute decoration I might use to force the proper case in the generated type library?
Thanks.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
How do I add a url link to a lixtbox?
|
|
|
|
|
Write a class derived from Listbox. It doesn't do that otherwise.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Created a default form. How can I prevent from user clicking and dragging one of the corners to resize the form?
|
|
|
|
|
Easiest way: set the FormBorderStyle property of the form to FormBorderStyle.Fixed3D .
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
From another forum I've read that it isn't possible to get a Repeater control to trigger the ItemCommand event when a dropdownlist selection is changed or a checkbox check is changed.
I'm apt to believe the other forum, since it is generally true and helpful, and my own experiences bear this out.
I would like use a repeater control because it simplifies and reduces the coding I need to do to generate the list of items.
Is it possible to get events from a dropdownlist or check box that are within a repeater control?
The wisest of the wise may err. - Aeschylus
|
|
|
|
|
I'm having a hell of a time using the EventLog class within a windows Service.
The service runs fine...no errors but does not write to my custom event log.
The service is running with LocalSystem Account privilages and I'm logged on as an admin.
Here is the code I am using:
public const string EventLogSource="BLOBUpdateService";
public const string EventLogName="BLOBUpdateEventLog";
..
..
..
..
m_Log = new EventLog();
if(!EventLog.SourceExists(EventLogSource))
EventLog.CreateEventSource(EventLogSource,EventLogName);
m_Log.Source=EventLogSource;
m_Log.WriteEntry("Service Started...",EventLogEntryType.Information);
Nothing is getting written to the log.
Any thoughts ?
|
|
|
|
|
I solved my problem.
I started to use the static EventLog.WriteEvent method rather than using an instance of the class.
|
|
|
|
|
Is there any way I can globally change DateTime.ToString() to use a 24hr clock instead of am/pm? From initial googling it appears that this is controlled by culture settings, but I'm not having any luck finding specifics.
If not I could do a global search/replace and feed a format string into each call, but that would leave any new additions open to a bug if I overlooked making the change there.
|
|
|
|
|
Do you mean change it globally on your PC? To do that you would:
1) Open Window's Control Panel.
2) Click on "Regional and Language Options".
3) Click the Customize button in the Regional Tab.
4) Select the Time tab.
5) Enter/select the following Time format: "HH:mm:ss"
|
|
|
|
|
No, just for my application.
|
|
|
|
|
Try this...
System.Globalization.CultureInfo info;<br />
info = System.Globalization.CultureInfo.CurrentCulture;<br />
info = new System.Globalization.CultureInfo(info.LCID, true);<br />
info.DateTimeFormat.ShortTimePattern = "HH:mm:ss";<br />
info.DateTimeFormat.LongTimePattern = "HH:mm:ss";<br />
System.Threading.Thread.CurrentThread.CurrentCulture = info;
|
|
|
|
|
Thank you for pointing me in the right direction, the one I actually needed to change was FullDateTimePattern.
|
|
|
|
|
hello, i have a listbox with some items in it, in this form:
client #1 - 255.255.255.255:8000
where the ip, port, and client number changes length (number of digits). how can i convert the client # in this to an int (stored in a variable), but not get anything else in it? (using clients.SelectedValue)
thanks in advance,
sam kline
|
|
|
|
|
You can use string mashing, or you could use a regular expression
client #(\d*)
seems to me like it would capture the number for you
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
how exactly would i do that? everything i try gives me exceptions.
thanks in advance,
sam kline
|
|
|
|
|
What did you try ?
string s = "client #1 - 255.255.255.255:8000";
Match match = Regex.Match(s, @"client #(\d*)", RegexOptions.IgnoreCase);
MessageBox.Show(match.Groups[1].Value);
This shows '1' in a message box.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thanks a lot! it worked.
try
{
Match match = Regex.Match(connectedusers.SelectedItem.ToString(), @"client #(\d*)", RegexOptions.IgnoreCase);
return Convert.ToInt32(match.Groups[1].Value);
}
catch (FormatException)
{
return 0;
}
catch (NullReferenceException)
{
return 0;
}
|
|
|
|
|
I want to use GDI to draw some images in a "fullscreen" mode. What is the best way to do this? When I seem to hide pieces of my form turn it black and make it the resolution of the monitor there seems to be a "pause" when covering up the start menu. This makes me think I'm not approaching it the right way. Anyone know the proper way to do this?
|
|
|
|
|
Just resize your window so that the non client areas are outside the bounds of the screen.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I order to switch to a "fullscreen" mode you must set the Window class's
dwExStyle=WS_EX_APPWINDOW;
dwStyle=WS_POPUP;
And force the window to fill the entire screen.
I think the changes to the window class I mentioned above can be achived if you set the border property of a window to none. And, if you have problems with the TaskBar, set the TopMost property to true
I hope you understand...because is a rough world out there...
|
|
|
|
|
How would you program a generic collection class to allow only classes inherited from, say Person, class. Here is the code article by Mahesh Kumar on this subject. He codes this for any type, but suppose in his sample, employee and customer are of a particular type, say, "Worker" how would this code be changed.
smh1
|
|
|
|