Answer Questions
Bubo Conversion Issue from VS.NET 2002 to VS.NET 2005
All the classes are converted to partial and in the user controls the shared property has following error. "Reference to a non-shared member requires an object reference". Hi, Vishal VS 2005 uses partial classes to allow multi-source-file classes. Especially useful when separating the Form developer from the code behind the form. As for the shared properties, at each of these errors you should get an option to replace the object reference with the class name. Shared properties and methods cannot access internal data structures in the class, thus the error. Can you post an example Partial Public MustInherit Class workingNewHeaderControl2 Inherits System.Web.UI.UserControl Protected ...Show All
reichard Centering one form inside another
Another Newbie question.... How would I need to write the code to open form2 centered within form1 when form2 is selected from a menu item on form1. forms1 and 2 are regular forms not MDI parent or child. Hi, try setting Form2's StartPosition property to 'CenterParent'. If Form2 is opened from Form1's code, that should work... Andrej Or an alternative is setting both forms to center screen, which would in turn force the form2 to be centered inside of form1. I tried that and it didn't work, form2 still opens off somewhere else on the page. Is there some relationship I need to establish first to designate form1 as a parent and form2 as a child If so what's the code to do that Also ...Show All
Ralf Kornmann Embedding Images
Hi, For this little application of mine, I was thinking about embedding the image file within my solution in Visual Studio 05 as a resource, instead of accessing the folder on my hard drive. I followed the steps of embedding the image as taught in MSDN, but for some reason after I click on Project->Add existing item..I don't get the option of having the image as an embedded resource. Can someone tell me how to actually get the image as an embedded resource and subsequently use it in my code. Thanks.... thanks You don't need to bump so much. To add the image as an embedded resource, go to Project->Add existing item, as you said. Change the file type dropdo ...Show All
akilah Picture + Text in One richTextBox
Dear All I want to create a RichTextBox, and then i want to show picture and Text at a time, suppose Welcome to MSDN Forum how can i accompalished this task. Thanks jehan, there is an example on codeproject that might help. HTH --mc Dear All, Mario Cossi is the best person, he assist me what ever i wanted to do, he is the best, thank you Mario Cossi my problem solved and now i can do what ever i wanted, for others who want to do like me, Step 1 Create table imageTest create table imageTest(img image); Step 2 to insert text+images to database, use following code public void insertToDatabase() { connection.Open(); SqlCommand cmd ...Show All
Mark Ornelas Whats the equivalent of __LINE__ and __FILE__ in C#
Whats the equivalent of __LINE__ and __FILE__ in C# I thought this hot-button issue would have been answered by now. But no one seems to have a good answer for this. I would love to see a solution which presents no runtime overhead. What about C# 3.0 does it address this issue If you want to log exception information then the exception itself should give you enough inormation. I think that if you want to use fault logging then you'd best use the System.Diagnostics namespace. Don't worry about the overhead. It's not that much and if you'ld only use for fault logging it doesn't really matter that it takes a little bit more time. Because the clr is a virtual machine, there's enough information you can query when thinks go wrong. In th ...Show All
Alex2200 How to Make Form "Snap" to the Screen Edge of Another Form?
Hi... How to Make Form "Snap" to the Screen Edge of Another Form Is there are way to do it on C# Thanks. Use this code to snap a form to the upper left corner of the main form: Form f1 = new Form (); f1.StartPosition = FormStartPosition .Manual; f1.Location = new Point ( this .Location.X, this .Location.Y); f1.Show( ); Khalid Ashraf wrote: Use this code to snap a form to the upper left corner of the main form: Form f1 = new Form (); f1.StartPosition = FormStartPosition .Manual; f1.Location = new Point ( this .Location.X, this .Location.Y); f1.Show( ); How about just snapping it to the bottom of another window Thanks. ...Show All
Alexie1668 System.ArgumentException: ContextMenu cannot be shown on an invisible control
"System.ArgumentException: ContextMenu cannot be shown on an invisible control" Again, one of the computer running the program pops this error at the time the program starts... all other computers don't have such problem... What can be the possible cause It's difficult for me to post the code because it's too long and I don't know which segment of the code is likely to cause the problem... I searched Google but most related results are not English..... It seems .NET has lots of this weird problem or just my programming problem Hmm, I cant understand what has ArgumentException to do with Showing up the Context Menu Anyhow, Where you are showing this Menu Post pieces of code wh ...Show All
markse namespace const and enum
I have to have a set of const long values available over the entire namespace: namepace MyNamespace.ValueAdjuster { internal const long MAXVALUE = 10000000; // not allowed internal const long MINVALUE = -10000000; //not allowed internal enum ValueRanges { Min = -10000000, Max = 10000000} // ok public class ValueAdjusterA { //adjust values , ensure within max ranges public Adjust (long paramA, long paramB) { if(paramA < MINVALUE) //would wourk well, if I had consts if(paramA < ValueRanges.Min) //doesn't work, requires cast } } How do I avoid the casting of long values on every assignment operation with longs All values int he namespace are long values, and I d ...Show All
max-holz HELP - How to Read/Write a text file at the same time?
How can I read and write a text file(same file) at the same time I'm getting an error of "this file is being used by another program".. I have a text log file and logs being written to it, simultaneously I want to read its concent and show them on a RichTextBox. How can I achieve this Thanks you can't... The best you can do is try to make your writes/reads as fast as possible so that there are no collisions - but it might be dangerous (your app may be prevented from writing by your reading). You'd have to create an alternative scheme - like writing logs to database, use TraceListeners or periodically changing your log file. charliebrown23, the way to go, ...Show All
G. Dean Blakely Rendering Streaming Video from a video server
I am doing an application which will render video from a capture card or from a video server on the network. I have some code to get the capture card to work. I have an activex control to get one video server to work. I am looking for help rendering Windows Media Encoder stream. Any information about where to post this question or any relevant responses would be appreciated. Thank you. which language are you developing with C# .NET 2.0 ...Show All
Saroj K. Nanda how to get windows service logon account
In my application i need retrieve the all services is running on the my machine and the logon account of service. the services information i retrieved with ServiceController, but the Logon account i can't found how If the question is how to retreive the account information of the user who logged on to the machine: try the Environment.User object. There's lots of info over there like the domain the user logged on to and the name of the user. If that wasn't the question, please clarify the real question ...Show All
Mazzica The ! Operator
Hello friends If Not encryptnumber Mod 2 = 0 Then I want to write this code C# How to Write thanks for help or if((encryptnumber & 1) != 0) { ... } just playing with my bitwise, cheers! if ((encryptnumber % 2) != 0) { ... } ...Show All
johnnyXNA Typing in Visual Studio 2005 Text Editor is extremely slow
Has anyone else noticed that typing in Visual Studio 2005 is extremely slow Whey I type it seems that the screen is always 2 words behind where my hands are. It makes it extremely frustrating to get anything done. I'm mainly referring to C# code. It seems like Intellisense is going nuts trying to guess every word I'm going to type and never actually prints the characters to the screen. Has anyone else experienced this Is there an option I can turn off to get my text editor back ! By the way, I have a very fast computer with Dual 3.0 GHz Zeons with 3GB memory and everything else that should make "typing" very fast. I had the same problem - very slow typing - after I turned on wordwrap. I have now turned ...Show All
zackasan export datagridview to Excel Document
I did a search and did find a post on this however I couldn't get it to work but I was wondering if anyone had a solution to exporting datagridview columns and data to a excel spreadsheet One simple solution is to create a csv file with the data. You just have to write a for loop on your datasource, dump the data in the file in the csv format, and then you can dblclick on the file to open it in excel. Charles ...Show All
jonathan03 Typecasting Arrays
Hi, I am facing some problem while typecasting arrays. I have folowing line of code (test code) // Define in one function that returns object (array of float, double, int etc.) float [] test = new float [2]; test[0] = 1.1F; test[1] = 2.2F; object obj = test; // When I recieve this object back to caller fiunction I have to manipulate these individual elements // So I typecasted this to object[] object [] objArray = ( object [])obj; Now this line of code gives me run time error. Is it that we can not type cast arrays Thanks Nitin Not from an array of a value type to object[] you can't. That would require boxing of each element. Why don't you cast t ...Show All
