Answer Questions
bluestar TabControl MouseHover!
hi everybody, How can I know which tabpage I'm on when I move the mouse please! dunno why my post turned out the way it did, but the "light bulb" is supposed to be [ i ]. - km Fahd, at a glance, the solution outlined by kode monkey should work. As far as I know, GetTabRect is the only way you have to detect the tab. Try this simplified version (which also selects the tab for you): private void tabControl1_MouseMove ( object sender, MouseEventArgs e) { for ( int i = 0; i < tabControl1.TabCount; i++) { if (tabControl1.GetTabRect (i).Contains (e.Location)) { if (tabControl1.SelectedIndex != i) tabControl1.SelectTab (i); break ; } } } ...Show All
willajo How do I Retrieve text from other programs?
Hi guys, I'm currently trying to come up for a solution for the following problem: Right now the user is reading values off a screen and manually copying them into another window to store in a databse. Because of the closed nature of the program they are using I can't edit the program, and was trying to figure out how to automate this process. Summary: I want to read the displayed text values off the window of another program. anyone know how to do this Or at leaste can anyone point me in the right direction for some learning sources or api classes that might be related Thanks a bunch, Right, there is no parent of appliation windows, and therefore no real root window. Mark is correct tha ...Show All
jjre Inaccurate/Wrong calculations
Hi, I working on a fairly large project in C#, combining numerous components such as SQL and DirectX. We all, however, seem to have come across a severe problem! We can't do basic arithmetic! For example, in VS.NET 2003, I need to subtract two UTC style time values - eg 11565456546546.1342345566 etc. double large_val1, large_val2; ... double difference = large_val1 - large_val2; Instead of the result I expect (and indeed the result shown in the Watch window during debug for large_val1 - large_val2), I get a servely rounded value instead - that is entirely useless!! Help!! I can do this in a standard command line / console application and everything works fine - why should there be any difference ! I have tried decimal, ...Show All
Philip Simons Java HashMap in CSharp
What is the equivalent of java hashmap in Csharp http://DotNetWithMe.blogspot.com vikas goyal The closest one is System.Collections.Hashtable: http://msdn2.microsoft.com/en-us/library/system.collections.hashtable.aspx If you are using .NET 2.0 you can also try using the generic dictionary System.Collections.Generic.Dictionary<TKey, TValue>: http://msdn2.microsoft.com/en-us/library/xfhwa508.aspx Java has both HashTable and HashMap. I believe both are same except that HashMap is not synchronized which makes it more performant. do we have such collection available in CSharp vikas None of the .NET Framework collections are synchronized by default. In the ca ...Show All
scruber windows services
folks, i have a basic windows service that I want to be started and run an application at a given time everyday. I have the foll..code in my timer's not sure I am not able to start any application through the service..nothing is happening once the service is started..the logs are updated displaying my written messages but the application does not get started for some reason..is there something i need to check..does windows service kick of applications only in the background private void OnElapsedTime( object source, ElapsedEventArgs e) { DateTime curTime = DateTime.Now; DateTime runTime = Convert.ToDateTime( this .targetTime); string formatString="MM/dd/yyyy HH:mm:ss"; if (runTime.ToString(fo ...Show All
DouglasJWoods any sample code for calculating "variance" (statistic)?
Hi, i'm trying to compute variance-covariance matrix (finance). I'm wondering if there is any free sample code of library that can help me such as codes that computes variance(like in statistics). Is there any free sample code or libraby for that Thank you in advance. Hope this helps: http://msdn.microsoft.com/library/default.asp url=/library/en-us/csspec/html/vclrfcsharpspec_12_5.asp BR hi, In SQL Server method stdev (express) is available to calculate standard deviation, and many aggregate methods in it. Otherwise, there are also a lot of statistic methods in crystal reports and excel. BR Oh I didn't mean the covariance type. I mean the cova ...Show All
Jason D. Camp Exception???
System.ObjectDisposedException: Cannot access a disposed object named "DataGridTextBox". Object name: "DataGridTextBox"......I am getting this exception and unfortunaltly i dont know why or how to catch the exception so i know what line of code is throwing this....any help on how i can get this error handeled step through the debugger and see at what line the exception happens on. Usually it will take you to that line. You are trying to access/use an object that has been disposed of. It's an ObjectDisposedException so you are doing something after the object has been disposed of Actually when i do this it throws all kinds of exceptions that i never thought i had.....It does not have that exception that i a ...Show All
Leandro Rodrigues Filter an Array
I have an array that is loaded with any files that the user has selected in a file browser dialogue. Right now the array gets loaded with everything in the folder, but I just want it to load image files that can be used as a wallpaper. Also I would like it to grab anything that is in any sub directories as well. can you show the code you are viewing in regards to showing anything in the subdirectories for files.... string[] theFiles = Directory.GetFiles( path , "*", SearchOption.AllDirectories); in regards to just showing the image, why are you storing the file in an array why dont you just do an Image.FromFile( fileOpenDialog.FileName ) on the pictureBox this.thePictureBox.Image = Image.FromF ...Show All
Hans1982 Dynamic Thread Creation
Greetings everyone, I have found myself in an empasse while trying to dynamically create an array of threads. Let me try to explain what I mean by "dinamically creating". One of the four overloads of the Thread constructor takes as a parameter a ThreadStart delegate, which needs a method name in order to be fulfilled: System.Threading.Thread m_MyThread = new Thread(new ThreadStart(MyMethod)); My scenario is different and a bit more complicated, in fact I haven't been able to find a working solution - I'm not even sure if what I'm trying to accomplish it's possible at all. I am developing a plug-in system for a commercial 3D engine. Some methods inside these plugins can be run on a different thread if the plugin devel ...Show All
dav3333333 How to convert string in ABCD format in to Unique integer
hi Is there any way to convert string in this format ABCD into a unique integer like 1234 Example: GWRS = 5232 SRWG = 7845 WTMS = 15 YOMS = 142 int X = ConvertMyString("GWRS"); private int ConvertMyString(string sTring) { } and so on ...... You are right, I skipped the method name. int n = BitConverter .ToInt32 (Encoding.ASCII.GetBytes ("ABCD"), 0); Sorry. --mc You might want to take a look at the GetHashCode method. It might do what you're looking for. If it's always a 4-letter code and you don't care about getting large numbers, you could do something like: int n = BitConverter (Encoding.ASCII.GetB ...Show All
cmolinap static methods
I ve a question on static methods.It has been said that static methods can be invoked using the class name directly i.e., without creating objects.how ll be the static methods present in the heap.when ll it be instantiated.How many number of such methods ll be in the heap.wont this cause performance degradation Static methods belong to the type, not the instance of an object and Only pointers to a static method have to be moved around in memory (8 bytes). The static method itself will be loaded once, very early in the application lifecycle, instead of being contained in each instance of our class. This enables you to call your static method directly e.g. from your referenced DLL file. if you're more curious then try this topi ...Show All
robinjam documentcomplete event
I've got a really weird problem with my application; it works on some pc's, and it doesn't on some others. What I've got: A Visual C# 2005 console application with references to MSHTML and SHDOCVW. I use mshtml to get a list of currently open browser windows, and attach events to it to edit the list when a new browser window is created or closed. I attach a documentComplete event to each open browser window and handle it the event there (let's say it prints out the url where is navigated to). So when I run this program, it should detect when I open a new browser window, when I close one, and it should print out the url of a site when it is done loading it. And there's my problem. On a few pc's, it all works perfectly. But o ...Show All
Charles Tam how to prevent Editing reference types from out side my class?
hi, i just want to understand this, its recomended to use properties as wrapper for class members to control editing or to check the value or what ever, actualy thats good but with reference types i found this is almost useless for example i wrote this class to demonstrate my point if i have a list of strings , and the property is ReadOnly but i still can edit the list, yes i can't change it but i can edit it using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main( string [] args) { test tst = new test (); Console .WriteLine( "before Adding\n\n" ); foreach ( string s in tst.Items) { Console .Write ...Show All
tritontr21 How do I choose which class to create during runtime?
I have one class X and some clases X1, X2, ... that inherit from X. I want to be aple to input text during the execution of the program - a text like X1 and than I want that object to be created. The code should go something like this: String s = null; Console.ReadLine(s); Type t = Type.GetType(s); X x = new t(); but it doesnt work. Is it posible to do this with C# Thanks,Zanzamar Try using Activator.CreateInstance() instead, so that last line would become: X x = (X)Activator.CreateInstance(t); ...Show All
thegodfather9210 Format String??? Help --->
I need to convert a string from bytes to megabytes. I have this so far: label1.Text = string.Format( ) but how do I format the string Hi, Your code modified: label6.Text = e.Bytes.Received.ToString(); label8.Text = String.Format("{0:#,##0,,.0MB}", e.Bytes.Received.ToString()); Hope this helps > I can only assume you mean to divide a number in a string by a million. in that case string.Format would be useless for this. String.Format can be used to divide by a million, e.g.: String.Format("{0:0,,MB}", 1234000) gives "1MB" String.Format("{0:#,##0,,.0MB}", 1234000) gives "1.2MB" String.Format("{0:#,##0,,.00MB}", 1234000) gives "1.23M ...Show All
