|
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
|
|
|
|
|
Not used VS 2005 yet but from a little bit of reading around the subject I'd guess that you would use generic constraints for this type of problem.
Not sure of the syntax from memory but something like
Collection<Employee> where Employee : Worker
i.e., Employee has to inherit from Worker or implement an interface called Worker (IWorker for .NET of course).
Kevin
|
|
|
|
|
In VS2005, you'd do this
ArrayList<Worker> list = new ArrayList<Worker>;
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
There is no generic ArrayList in VS2005.The generic equivelant of the Arraylist is List<T>.So you could write
List<Worker> list = new List<Worker>();
-- modified at 18:31 Tuesday 22nd November, 2005
|
|
|
|
|
*blush* I did notice that, actually. But I forgot.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I think I did not formulate this properly (partly because I don't understand it fully). Question is; what is the syntax in C# for using multiple contraints on a generic collection class that uses the collectionbase.
The sample that I show in my text is from an article that appeared here where Mahesh uses the CollectionBase for a generic collectionclass but does not use multiple contraints. So that is my problem.
If I don't use CollectionBase I have to use an array, I guess, which I didn't want to use because the Collectionbase code for insert and remove is so nice.
Thanks
smh1
|
|
|
|