Answer Questions
jeevankumar Does using(IDisposable) induce boxing?
If I have a value type Foo: struct Foo : IDisposable { void Dispose() {}; } And I place an instance of Foo in a using block: Foo bar = new Foo(); using (bar) { ... } My understanding is that bar.Dispose() will be called at the end of the using block. My question is, does this induce boxing Since Foo is a value type, and IDisposable is not, will the C# compiler cast bar to type IDi ...Show All
SimonTeW A common application for recursion
Hi, A common application for recursion is the problem of generating all possible permutations of a set of symbols. For the se consisting of symbols A,B and C there exists six permutations - namely, ABC, ACB, BAC, BCA, CBA and CAB. The set of permutations of N symbols is generated by taking each symbol in turn and prefixing it to all the permutations which result from the remaining N-1 symbols. It is therefore, possible to specify the perm ...Show All
KillerBoy C# project always rebuild if Xml Documentation is set
Under Visual Studio 2005 Beta 2, I noticed that the C# projets are always rebuild if the option to generate xml documentation is set (and this make all the projects that depend on the project to always rebuild aswell) . The following steps can create the problem I'm talking about: 1) Create a new "Class Library" C# project 2) Build it. It should build it (i.e. you see in the output "csc.exe ..."). 3) Build it again. It should not build it (ie. ...Show All
Macktr cast
how to you cast from string to object this code below is not right. Can you please help private object XMLcount( string msg, string title, string defaultresponse) { string items; items = Microsoft.VisualBasic. Interaction .InputBox(msg, title, defaultresponse, 129, 148); return object (items); } Every class and struct are of the type Object, so you never have to cast a clas ...Show All
TrevorT determine if running in IE
hello, Is there some way for a C# dll to determine if it's running in IE, and, if so, redirect the page This is using the v1.1 Framework. I cannot speak to being able to control IE from your control as I have zero knowledge or experience with even attempting such a thing. Worse yet I’ve been unable to find any good documentation on how to do such a thing, nor on how to have the User Control interact with ...Show All
sjphere rtf to image
Hi, i need to transform the contents of a richtextbox (rtf) to an image. Any suggestions will be highly appreciated Thank you Peter Ritchie wrote: You could try raising the OnPrint event, passing a Graphics object that is associated with an image. Something like (aircode, not compiled or tested) Bitmap bitmap = new Bitmap(100, 100); // change size to suite needs using(Graphics graphics = Graphics.FromIm ...Show All
Nate Stewart Error Installing and Running C# Beta 2
Whenever I install C# Express Beta 2, I get an error message during the install process of C# Express (An error has occurred would you like to send an error report). The installation continues just fine. When I open C# after the installation completes, I can go to file > new project, but the templates listing is empty. If I try to open an old .sln or .csproj, I get another error message and C# crashes. Here is a list of the things I've tri ...Show All
Ralph Deleja-Hotko What's the difference between += and =+?
Is there a difference between the valid += and the mysterious =+ They both compile, is this correct You got it backwards, += is the valid expression. =+ is the oddity. I'm just trying to figure out what the other's purpose is. n += 1 (n = n + 1) n =+ 1 ( ) Tom Meschter wrote: There is no =+ operator in C#; n =+ 1 will be understood by the compiler as n = +1. The ...Show All
Vaiduks tlbimp.exe and DllImport
I have a dll file that also comes with a .tlb file. When I tried to load the dll file, I imported the dll using tlbimp tool. The dll implemented an interface that exposes some functions... but when i tried to create an instance of the class in my dll file, it throws me : System.Runtime.InteropServices.COMException was unhandled Message="Retrieving the COM class factory for component with CLSID {9A85C592-4736- ...Show All
Blessy How do I multiply a number by pi
Hey, I'm currently programming a calculator application and I have found myself stuck on multiplying a number by the mathmatical value of PI. The number shall be inputted in to a textbox1 and the result shall be shown in textbox2. Does anyone have a solution to this All replys are appreciated regards Liam Thanks a lot Justin that worked just fine. try System.Math.PI that should help. I am also having problems showi ...Show All
Dayan_07 the dismatching error with "unsafe"
i need to use the native code(unmanaged code),and i have to use void*,so i use the "unsafe" symbol then i meet the trouble c++code: SC_InitAsk sca; memset(&sca, 0, sizeof(sca)); sca.m_Head.m_nType = SC_INIT; sca.m_dwSoftware = 0x12345678; sca.m_hWnd = m_hWnd; m_Dll.SCInit(&sca, sizeof(sca) c# code: unsafe { SC_InitAsk sca = new SC_InitAsk(); sca.m_Head.m_lIndex = PublicValue.SC_INIT; sca.m_dwSoftware = 0x12345678 ...Show All
qtvali Cannot add parameters to delegate.BeginInvoke : delegates parameters count mismatch
Hi, I have some trouble understanding why my code doesnt work the way I want. Clicking on a button launches a call to a thread for sending mails: // the delegate to the method sending mails delegate void mailingEntry(); //button clicked: go to the mail processing.... myMailerDel = new mailingEntry(sendBCCLoop); myMailerDel.BeginInvoke(null, null); the fonction sendBCCLoop updates a progress bar while sending mails... As I first have to go back t ...Show All
dalenewman Error Help please!
Hello and thank you for taking the time to read this, I'am building an application for a hyperthetical club and I've come accross an error that does not make sense well sort of but I do not see the way around it. In the code below I've placed: /////////////////////// ERROR Accures Here! where it normally jumps out of the code. I have a class with setters & getters as well, but I dont think it is the problem... Ive added data to the array an ...Show All
pato135 Access to private variables with object of same type.
I've been working with C# for sometime and this may have been asked and answered many times but I am unable to find the answer anywhere. I've never done this before in code till just today and realized something didn't make sense. Why can I access private variables of same object types but different objects inside the class definition The following explains what I am referring to. using System; namespace ObjectTest { public c ...Show All
perri Detection of thread executing
I have read up some on utilizing threads, being a newbie to programming in C# and converted a major function in my application to execute in a background thread (to stop the display from freezing up if I switched to another application). The threading worked perfectly and it even terminates itself after completion. The only complication I have is that I cannot update the various text boxes on my form because they are part of other system thre ...Show All
