|
how to do the same with C# as scripting language
|
|
|
|
|
I"m curious..
I'm changing settings in my machine.config so my web service runs properly. Problem is .. I can't tell which configuration change is making it work properly. It seems to me like the machine.config file is being cached.
Is it? if so is there a way to prevent it from being cached ?
thks
|
|
|
|
|
Hey there,
When using Form.Close and you try to show the form again, it shows without a Titlebar
How do you close a form knowing that you will want to load the form again at a later stage?
|
|
|
|
|
form.Hide() / form.Show()
or
after Close/Dispose, use new Form().
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
I´m creating an application that does some automation with excel. The problem is that Excel sometimes is busy doing some tasks and can´t respond to my method calls. To solve this I´m using something similar to this;
while(true)
{
try
{
oWorkbook.Range(...);
}
catch(System.RunTime.Interop.COMException)
{
System.Threading.Thread.Sleep(100)
}
catch(Exception exp)
{
throw(exp);
break;
}
}
The problem is that I have TONS of this oWorkbook.Range(...); lines... and I don´t want to write this bunch of code to all of them. Does anyone know some alternative way to do this (some kinda template maybe) ? I know I can write a wrapper to do this... but it´ll give me a lot of work... and I´m trying to find a better solution.
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
Life is a mixture of painful separations from your loved ones and joyful reunions, without those two we'd just be animals I guess. The more painful the separation, that much more wonderful will be the reunion - Nish
"Th@ langwagje is screwed! It has if's but no end if's!! Stupid php cant even do butuns on forms! VISHAUL BASICS ARE THE FUTSHURE!" - Simon Walton
|
|
|
|
|
I've written a small app that retrieves the MAC-address from computors, using ManagementClass, ManagementObjectCollection and so on, eventually ManagementBaseObject.get_Item("MacAddress"); which turns out to work fine for most computors. Lately however I have discovered that for some computors a different series of numbers is retrieved. Looking into it a bit deeper I found that on all computors not one, but serveral items could be found calling get_item("MacAddress"). So my program did work for computors where the real MACaddress was the first to be returned (and apparently this included most computers).
Have I missed something? How can I tell which one is the real MAC address, and what are the other numbers?
Kind regards
/EnkelIk
Below a snippet of my code:
ManagementClass mc;
ManagementObjectCollection moc;
ManagementBaseObject mbo;
ManagementObjectCollection.ManagementObjectEnumerator moe;
string strMAC="",strTmp;
mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
moc = mc.GetInstances(); // Get network adapter instance
moe=moc.GetEnumerator();
//Loop till MAC address found
while(moe.MoveNext())
{
mbo=moe.Current;
if(mbo["IPEnabled"]!=null)
{
Object pObj;
//Get MAC address
pObj=mbo["MacAddress"];
if(pObj!=null)
{
strTmp=pObj.ToString();
strMAC=string.Concat(strMAC,strTmp);
//Remove colon
strMAC=strMAC.Replace(":","");
break;
}
}
}
|
|
|
|
|
The answer is often simple when you know it... Debugging more carefully I found that mbo["IPEnabled"] is a System.Boolean -it is either true or false, but never null.
/EnkelIk
|
|
|
|
|
How to get Sysmenu in Winforms?
|
|
|
|
|
use pinvoke and call the getsysmenu api
/Roger
|
|
|
|
|
Hi,
I am developing usercontrol drag and drop.
DragSource: UserControl
DragDest: DataGrid
My Quesiton here is can I change Cursor (mouse icon) while draging? It gives Drag Effects for the Cursor like Move,Copy, None etc. I want to change the Cursor type say for example IBeam or Hand type Cursor instead of Move Effect. (Letting the Move effect remain same with having Cursor Image changed) is it possible ?
Could someone lead me to some direction or give me some link ?
kindda stuck
Thanx,
Paresh
|
|
|
|
|
anyone knows let me know ASAP...
|
|
|
|
|
I'm allowing the client user to upload his file onto my server. Now how do I find out the file's ORIGINAL last modified date and time?
If I use any of these File methods:
File.GetCreationTime()
File.GetLastAccessTime()
File.GetLastWriteTime()
I get the same date and time, namely, the time corresponding to the instant the file was uploaded. But that's not the file's original modified date. How do I get the original modified date of the (as seen by the client)?
|
|
|
|
|
It's probably part of the HTTP response header (Last-Modified).
Todd Smith
|
|
|
|
|
I have Panel control on Form. But, when I change context in it, I want to repaint it.
How to force Panel, to be repainted ?
10x
best regards, sebastijan
|
|
|
|
|
sv7874 wrote:
How to force Panel, to be repainted ?
You could call Invalidate() .
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|
|
Hi all,
I have a c# class derived from MenuItem that I am using for ownerdraw menu items. I set the OwnerDraw property to true, added the DrawItem & MeasureItem methods. I tested my class with a form, attaching the context menu to the form, and it worked great, the DrawItem & MeasureItem methods get called. However, if I try to use the context menu with a traybar application, the methods don't get called. Is this a known issue or what am I doing wrong or is there a workaround?
thanks
warbler
|
|
|
|
|
Salamo 3alekom
I tried to open a PE file with a program called PEExplorer .. Opend the header & discoverd that all the items in the header is correct..
but i found something strange i igot "the address of entry point" field from the header but when i checked that address i found it's so different from the contents that the PEExplorer program shows...
i found that the "image base" field is added some times 2 the address of the entry point field...
for example the address of entry point is: 0000E67Ch
& the image base is: 01000000h
but when i run the disassembler view of the PEExplorer i find that the address of the entry point is 0100E67Ch & this address can't be located coz the file size is smaller than it & the contents that the disassembler show in this location 0100E67Ch i can find it in another different place in my file
plz does any one knows how is this operation handled & how can i reach 2 the real entry point of an exe file...
my email is
blacksun_damn@yahoo.com,
ashshab_beh@yahoo.com
blacksun
|
|
|
|
|
you can launch a file using system.Diagnostic but how can i pass it command line args... i have not need of this right now...just curious about it
Feeding my ever growing hunger of C#...
Jesse M
|
|
|
|
|
Hi Jesse,
Check out the following:
using System.Diagnostics;
public class notepad
{
public static void Main(string[] args)
{
System.Diagnostics.Process process = new Process();
System.Diagnostics.ProcessStartInfo pStart = new ProcessStartInfo();
pStart.FileName = "notepad.exe";
pStart.Arguments = "a b c d";
process.StartInfo = pStart;
process.Start();
}
}
You can start using ProcessStartInfo to assign various attributes to Process and then start the process.
Does this help?
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
cool thanks alot man... it will help alot !! i got another question that maybe you can help me with.... i wrote a full featured wordpad type program.. with a spell checker and all images embedded with in the program. when its running it takes about 14 megs of memory....but ill load a txt file thats 7 megs in size into the program and all of a sudden it is taken 50+ megs. any ideas on how i can fix this problem.. heres how i open it... is there a better way that i use too conserver memory ?(when notpade opens this file it only takes 8 megs of memory)
*** begin code ***
<br />
FileStream fs = File.OpenRead(LoadFileOnStart);<br />
byte[] b;<br />
if(LoadFileOnStart.ToLower().EndsWith("rtf")|LoadFileOnStart.ToLower().EndsWith("doc")){<br />
fs = File.OpenRead(LoadFileOnStart);<br />
b = new byte[fs.Length];<br />
ASCIIEncoding temp = new ASCIIEncoding();<br />
while (fs.Read(b,0,b.Length) > 0) <br />
{<br />
MainTextArea.Rtf = temp.GetString(b);<br />
}<br />
}<br />
|
|
|
|
|
Hi, coders!
I have a little bit stupid question...But I couldn't find an answer to it so far
I wanted to add a menu item "delete" for a standart textbox control.
I am reading Charles Petzold's Programming windows width C# and he wrote in his book the following code to respond to menu item "delete" clicked:
txtBox.Clear();
The very problem is that this DO CLEAR the entire text in the control and I want only the selected one to be deleted.
Then I wrote that:
txtBox.Text = txtBox.Text.Remove(txtBox.SelectionStart,txtBox.SelectionLength);
txtBox.Modified = true;
It works but there is a little problem: as the text in the control is updated the caret is positioned at the beginning...Unfortunately .NET Framework don't provide something like MoveCaret function
Any ideas how could I implement that simple delete command(the only way I can think of is to override WndProc and the WM_CLEAR message - but no WIN32, right )
Regards!
Gogou
|
|
|
|
|
Gogou wrote:
Unfortunately .NET Framework don't provide something like MoveCaret function
O dear
MoveCaret =
SelectionLength = 0;<br />
SelectionStart = Text.Lenght - 1;
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
Well,I said it is stupid question
Tnx!
|
|
|
|
|
Hi,
Does anyone know of a way of getting any scolling events from a ListView control ? I want to be able to fill a ListView control on demand (paging) as it can display very large amounts of data. So as the user scrolls down i access and load rows.
Can this be done with the standard .Net Control ? Or is there a 3rd party control that can do this ?
Thanks ... Andy
|
|
|
|
|
Even though I haven't tested it for scrollers, I believe it would be fine if you override the System.Windows.Forms.ListView.WndProc method, and provide a switch case handler for WM_VSCROLL messages.
PS : if you thought you would get rid of WIN32 that easy, bad luck!
|
|
|
|