|
Perhaps this line has an error:
user = (UGUserNode) nodes[userGroupID];
try to use the "as" keyword for casting...
user = nodes[userGroupID] as UGUserNode;
then check if your variable user is null, if so it means it's not the same type as your UGUserNode class.
this i think is the safest way of casting if your not sure of the type of the object you want to cast.
hope this helps!
microsoc
|
|
|
|
|
I have two things I wish to accomplish:
1) Based on the current date determine the StartDate of the current Work Week and the End Date of the current Work Week.
2) Based on the current date generate a list of the prior 10 work week ranges and the upcoming 10 work week ranges.
I would like to implement both of these as public methods within a class. My language of choice is C#
Thanks In Advance
Palestine
|
|
|
|
|
TAREQ F ABUZUHRI wrote: I would like to implement
Emphasis on the word I. Is there a problem you're encountering while writing these? A specific question?
Logifusion[^]
|
|
|
|
|
There is one big problem with work week calculations. Observered holidays, see :http://www.codeproject.com/dotnet/HolidayCalculator.asp for that. After that work week is trivial.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I have a datagrid and would like to pass a value from a specific cell from that dg to a label in the same page. Could I do that on a page load event? If yes, please show me how. Thanks
|
|
|
|
|
Im developping for PPC with VS2005 and C#. how do we generate basic sounds like a beep in PPC?
thank you
Donkaiser
|
|
|
|
|
http://msdn.microsoft.com/msdnmag/issues/03/07/NET/
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I think I kinda get it how the process work to play a sound. I got this codes from VS2005 help. but when i passed my stream as a parameter a the button level, it doesn't find it. how do i get the right directory of the sounds sample?
public class Sound
{
[DllImport("CoreDll.DLL", EntryPoint = "PlaySound", SetLastError = true)]
private extern static int WCE_PlaySoundBytes(byte[] szSound, IntPtr hMod, int flags);
private byte[] m_soundBytes;
private enum Flags
{
SND_SYNC = 0x0000, /* play synchronously (default) */
SND_ASYNC = 0x0001, /* play asynchronously */
SND_NODEFAULT = 0x0002, /* silence (!default) if sound not found */
SND_MEMORY = 0x0004, /* pszSound points to a memory file */
SND_LOOP = 0x0008, /* loop the sound until next sndPlaySound */
SND_NOSTOP = 0x0010, /* don't stop any currently playing sound */
SND_NOWAIT = 0x00002000, /* don't wait if the driver is busy */
SND_ALIAS = 0x00010000, /* name is a registry alias */
SND_ALIAS_ID = 0x00110000, /* alias is a predefined ID */
SND_FILENAME = 0x00020000, /* name is file name */
SND_RESOURCE = 0x00040004 /* name is resource name or atom */
}
public Sound(Stream stream)
{
//read the data from the stream
m_soundBytes = new byte[stream.Length];
stream.Read(m_soundBytes, 0, (int)stream.Length);
}
public void Play()
{
WCE_PlaySoundBytes(m_soundBytes, IntPtr.Zero, (int)(Flags.SND_ASYNC | Flags.SND_MEMORY));
}
}
private void btnEmbedded_Click(object sender, System.EventArgs e) {
Sound sound = new Sound (Assembly.GetExecutingAssembly().GetManifestResourceStream("SoundSample.chimes.wav")); // null exception error
sound.Play();
}
Donkaiser
|
|
|
|
|
Application.StartupPath will give you the path
GetManifestResourceStream requires that the file be compiled into the assembly. also use the namespace. SoundSample is likely the namespace of the MS project.
Assembly.GetExecutingAssembly().GetManifestResourceStream("MyNamespaec.chimes.wav");
Another Method would be
new FileStream(Application.StartupPath + "\\filename.wav", FileMode.Open, FileAccess.Read)
to get the file from the machine in the path of the executable
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
|
It's for pocket PC. console.beep() won't work. or prove me wrong.
Donkaiser
|
|
|
|
|
Hello,
I have a listbox with 5 items, how can I disable the third item only, in order to make it unselectable?
Please help. Thanks.
|
|
|
|
|
Don't include it in the list.
I don't think there is a way since the items are just a collection, no way to disable one. You may be able to simulate the behavior by handling the selection and canceling it.
|
|
|
|
|
I currently have a set of DiComm images. I understand that stored within these images are attributes. I need to view these attributes and store the values along with the file in a database. What I seem to be having a hard time with is understanding how to view the header information within the actual DiComm file. Do I need a dictionary defined first? Does anyone have a sample that illustrates what I am looking for or can any point me in a solid direction?
Thanks,
Joshua
|
|
|
|
|
Hi,
I'd like to be able to show a tooltip when the user starts to drag the handle of a Trackbar control, and have that tooltip display the value of the trackbar control.
I really have no idea where to start on this. Tooltips disappear as soon as you mouse down, or mouse move.
Anyone know a technique or can give me a lead?
Thanks
Jon
PS. Using .NET 2.0
using System.Beer;
|
|
|
|
|
Activate or recreate tooltip on MouseMove.
My english is bad. Please, correct my errors.
Best regards, Alexey.
|
|
|
|
|
I have a COM object built in C#. Its a an IE deskband. It implements the following method:
<br />
[ComRegisterFunctionAttribute]<br />
public static void Register( Type t )<br />
Which gets called when regasm is used and it makes teh appropriate entries into the registry. Works great.
Now I am trying to build a installer for this using VS 2005. I did the following:
1. I added all assemblies to the GAC
2. I marked my dll as Regsiter vsdrpCOM in the property window.
The install works but my tool bar does not show up in IE.
The I tried the following:
1. I added all assemblies to the GAC
2. I added my dll to the prgram folder in addition to the GAC.
3. I marked my dll (the program folder one) as Regsiter vsdrpCOM in the property window.
Install works with no errors but toolbar does not show up in IE.
BUT, now if I use the commandline and regasm my dll (program folder one), bingo... everything works.
What do I have to do in the installer project to make this work. I know the installer lets you make registry entries, but I do not wish to do that. Its what the
<br />
[ComRegisterFunctionAttribute]<br />
public static void Register( Type t )<br />
is meant for.
My first hunch was that regasm was not working. On further inspection I realized that regasm was working but not completely.
My Register Method does the following:
<br />
if( 0 != ( style & BandObjectStyle.Vertical ) )<br />
rkCat.CreateSubKey( "{00021493-0000-0000-C000-000000000046}" );<br />
<br />
if( 0 != ( style & BandObjectStyle.Horizontal ) )<br />
rkCat.CreateSubKey( "{00021494-0000-0000-C000-000000000046}" );<br />
<br />
if( 0 != ( style & BandObjectStyle.TaskbarToolBar ) )<br />
rkCat.CreateSubKey( "{00021492-0000-0000-C000-000000000046}" );<br />
<br />
if( 0 != ( style & BandObjectStyle.ExplorerToolbar ) )<br />
Registry.LocalMachine.CreateSubKey( @"SOFTWARE\Microsoft\Internet Explorer\Toolbar" ).SetValue( guid, name );<br />
On inspecting the registry after installation I notice that all entries but the last one are in the registry. So whats going on? A manual regasm works for all of the above, an installer based one does not.
|
|
|
|
|
I should reply to my own post. I found the answer to this long ago, but never came back to update this. So here goes. Regasm comes with Visual Studio. So a machine with no visual studio and just the .Net framework will NOT have regasm on it.
Hence, you cannot rely on
[ComRegisterFunctionAttribute]
public static void Register( Type t )
For this is called by regasm. You need to find other ways to register your DLL and make otehr registry entries.
|
|
|
|
|
I have a control that is derived from the standard ComboBox. I want to lock or suppress the DropDown when the arrow button is clicked without disabling the control.
This is related to another post that I have out there for a custom OnPaint event. I want to provide custom colors for ComboBox that work even when the Enabled is set to false (by default it is set to Gray). I have provided a new implementation for the Enabled property to handle it myself. When the control is in my disabled state I am supressing KeyDowns so that it appears as if it is disabled. The only problem is that you can still drop down the list, and choose an item. If I can lock this, I'm good to go.
Oh, and I'd rather not have to use SendMessage in WndProc to accomplish this. I don't want to have a dependency on user32.dll.
--Ian;
|
|
|
|
|
--Ian wrote: I want to lock or suppress the DropDown when the arrow button is clicked without disabling the control.
Sound like a textbox with an image of an arrow next to it.
|
|
|
|
|
I'd also not like to reinvent the wheel. Everything else the ComboBox does is great, I just want to lock the drop down list from being dropped down.
--Ian;
|
|
|
|
|
I guess I don't understand. A dropdown without being able to dropdown is not a dropdown. A rose by any other name would be a textbox.
|
|
|
|
|
The problem is that I need a dropdown with my own custom Enabled property. When I disable it, I want to lock or suppress the dropdown list from being displayed. In other words, this rose must still be a dropdown.
Once again, the root cause for this is that the BackColor is set to Gray when the ComboBox is diabled by setting Enabled = false. The OnPaint event is creating other issues, as expressed in another post, and I'm looking for another workaround.
--Ian;
|
|
|
|
|
Hi CP,
May i know anyone get the things ?
Regards ,
|
|
|
|
|
I have a control that is derived from the standard ComboBox. I have an override for the OnPaint method that paints a border, drop down arrow button, background, and foreground. The only problem is that something (some other event/subcontrol) is drawing a black text box with a large font over top of the text box region of the combo box control.
I am drawing a background in my OnPaint event, and it is being draw on top of. I can see that the background is drawn because there is a border around the text box region. My code looks like the following:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
DrawBorder();
DrawBackground();
DrawArrowButton();
DrawForegroundText();
}
What am I missing here??? By the way, this control works just fine if the DropDownStyle is set to DropDownList, however I'm need it to work as a DropDown (being able to edit the text box).
--Ian;
|
|
|
|