|
|
|
|
Not sure, I will go check, I was help someone else here at work with it. I'll go check?
Nick Parker
|
|
|
|
|
Actually he did something different, the MemoryStream didn't error out, however it didn't return anything. He has it working now though, Thanks.
Nick Parker
|
|
|
|
|
I was wanting to replace my 'first' name with an edit that the user has performed. I am breaking up the information well, thanks to Eric Gunnerson's marvelous little regex program.
Regex regName = new Regex( @"?< Last >[^,]+)*(,)*( )*(?< First >\S+)*( )*(?< Middle >.+)$" );
String strFirst = "Jane";
String strCurrent = "Doe, John William";
Match pMatch = regName.Match( strCurrent );
if( pMatch.Success )
{
Group pGroup = pMatch.Groups[ " First " ];
if( pGroup.Index > 0 )
strReplace = strText.Substring( 0, pGroup.Index );
strReplace += strFirst;
if( pGroup.Index + pGroup.Length < strText.Length )
strReplace += strText.Substring( pGroup.Index + pGroup.Length );
}
|
|
|
|
|
The ToString(); method isn't doing it, is there another way?
Nick Parker
|
|
|
|
|
|
I believe you can also use BitConverter.ToString(), I don't have the documentation to hand, but I'm pretty sure thats it. The only parameter to ToString is the array AFAIK.
--
Paul
"I need the secure packaging of Jockeys. My boys need a house!"
- Kramer, in "The Chinese Woman" episode of Seinfeld
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
|
|
I guess the signatures are wrong, produce an exception in CLR, but are trapped in /dev/null so you don't see a sh*t.
In other words, your SomeFunc doesn't even have a return value. Was the code snippet a real code ?
This should be :
[DllImport("SomeLib.dll"), CharSet=CharSet.Auto)]
public static extern <something> SomeFunc(MyCallback callback);
public delegate int MyCallback(int bla, string foo);
And I swallow a small raisin.
|
|
|
|
|
|
From what I see in EnumFontFamiliesEx , you've got to marshall structures as well, thus redefine using C# all that NEWTEXTMETRIC and stuff. leppie has posted a lot about marshalling structures in this forum.
And I swallow a small raisin.
|
|
|
|
|
i dont need any of the text metric stuff, so ive just swapped that for object. ill have a look at what i may need to do with marshalling. but i have remade the LOGFONT and ENUMLOGFONT structures.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
you need to keep a reference to the delegate live while the Enum is in progress.
MyCallback foo = new MyCallback(DoSomething);<br />
<br />
SomeFunc(foo);<br />
<br />
foo = null
Otherwise the delegate becomes eligable for collection immediately (as it is passed into unmanaged code) and that could be what you are seeing.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
James T. Johnson wrote:
Otherwise the delegate becomes eligable for collection immediately (as it is passed into unmanaged code) and that could be what you are seeing.
Does the delegate NOT get collected if it is passed into managed code?
I thought I saw something about HandleRef, but I'm not sure if it applicable in this case.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
how can i tell C# to fill remaining space with '0'?
when writing:
string.Format("0x{0,4:X}",256);
i get
0x 100 but i want
0x0100
the msdn-documentaition just says "...is padded with spaces" - no word on changing the fill-character. is this possible at all?
:wq
|
|
|
|
|
String.PadLeft Method
Right-aligns the characters in this instance, padding on the left with a specified Unicode character for a specified total length.
public string PadLeft(int, char);
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
ah. not the way i thought, but an option.
thx
:wq
|
|
|
|
|
current workaround (input is a Int16, so 4 chars are always enough)
Int16 id =
string.Format("0x{0}{1}{2}{3:X}",(id<4096)?"0":"",(id<256)?"0":"",(id<16)?"0":"",id);
but thats kind of
:wq
|
|
|
|
|
int f = 256;
string s = f.ToString("0000");
And I swallow a small raisin.
|
|
|
|
|
I have a form with a menubar and a tab control. Each tab has a set of buttons which inlcude Close and Detach. Once I hit either of these buttons, the code works as expected. However after that my application refuses to exit.
The button I've played with the most, Close, has relatively simple code. It iterates through the COntrols on th emain form, finds the tab page it's looking for and then removes it.
I've traced my code and I know that Application.Exit() is being called but it's not forcing Application.Run to return. What could be going wrong?
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
There is a bug in the WinForms code that causes forms to refuse to close if their ActiveControl (ie the control that has focus) is removed. I would expect that this is what you are experiencing.
There are a number of workarounds available on the web and newsgroups (time for google[^]!). The easiest I've found is to manually shift focus to an off-screen, permanent control before you remove the other control.
--
Russell Morris
"Have you gone mad Frink? Put down that science pole!"
|
|
|
|
|
Ouch. Well the control that I am removing is just a tab page in the tab control. I'll just switch focus to another tab page and then remove the one I want.
Sh*tty bug. Hope they will fix it soon.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|