Answer Questions
ams_ashraf HowTo: Synchronize the local system time with server time?
What is the easiest way to synchronize the local time with a server time I tried to find a thread, but unfortunatly I only get results in Visual FoxPro forum. Is there some sample code avaible please Thanks, Andreas Here is the answer, feel free to use the code. If you find errors or if you have suggestions how to make it better please answer my post (I'm not experienced in Interop). using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.ComponentModel; namespace GF.Clock { /// <summary> /// Statische Klasse zur Behandlung der lokalen Systemuhr /// </summary> internal static class NativeMethod ...Show All
Bernaridho Parent and Child Tables
I have two tables joined Parent Table A Child TableB TableA is bound to a datagridview, In one of the columns I want to show a field from TableB. Can anyone explain how and where to put TableB.Field so it shows in the datagridview. This may not be the correct forum.. Well Use Sql Query to join two tables together and display the result (datatable) in the datagridview. Sql sentence: "SELECT TableA.Field1, TableA.Field2, TableB.Field22 FROM TableA, TableB WHERE TableA.Field1 = TableB.Field21" -- it seems that you decribed TableA.Field1 is the foreign key of the TableB.Field21, right If there is any problem pls feel free to let me know, thank you. ...Show All
MShetty Error for parent form serialport object...
Hi... In my application... I have declared a SerialPort object in parent form & i am accessing it from a child form but its giving an error in port 'open' method. Can anybody tell me where i am going wrong... Here is sample code for some more information... //In parent form public SerialPort comport = new SerialPort(); child_Form childForm= new child_Form();//this is the child form child_Form .MdiParent = this; comport.PortName = "COM1"; //In child form if(!((ParentForm)this.MdiParent).comport.IsOpen) ((ParentForm)this.MdiParent).comport.Open(); // Getting error on this line ((ParentForm)this.MdiParent).comport.Write("send the text on serial Port"); I am getting int ...Show All
Nim Chu Manipulations on directories.
Hi, I want to write a generic program to get the directory and all the sub directpries under it. The code which I have with me works only till next immediate sub directory Like string strDirName = @"E:\Cirrus" ; DirectoryInfo di = new DirectoryInfo (strDirName); if (di.Exists) { DirectoryInfo [] subDir = di.GetDirectories(); foreach ( DirectoryInfo dirInfo in subDir) { Console .WriteLine(dirInfo.FullName); DirectoryInfo [] nestDir = dirInfo.GetDirectories(); foreach ( DirectoryInfo info in nestDir ) { Console .WriteLine(info.FullName); } } Console .ReadLine(); } So this will display next 2 levels of directories But let say I have Test/Test1/T ...Show All
SP534 How to subscribe to event? ActiveX control in C#, client in C++!
I implemented an ActiveX control in C#. The interface looks like this: public delegate void FooDelegate(string bar); [InterfaceType (ComInterfaceType.InterfaceIsDual)] public interface IMyActiveX { // ... event FooDelegate Foobar; } Now, I'm stuck. I've got a client application for my control written in C++ / MFC and I can't figure out how to subscribe to the event. Anyone ... looks interesting, I'll give it a try. Thank you! Start with this article: http://support.microsoft.com/default.aspx scid=kb;en-us;181845 If the ActiveX control exposes the COM Interface correctly then that article should get you started. You'll need to create a sink; hook ...Show All
Tryin2Bgood Return / finally -- which one will execute Last in a method?
Hi I've a doubt regarding Finally block in exception handling, I'm trying the falllowing code public Dataset funct() { Dataset ds = new Dataset(); //Other declarations here try { adapter.fill(ds); } catch { } finally { ds.dispose(); } return ds; } In the above code I'm desposing the dataset before return, but it is comming in the method which is calling this method. when I'm debugging this application the control goes to finally block and executing return later. whats going on in this code. can anybody tell me please Thanks in advance but I'm disposing dataset in finally Finally is always executed so i this code is first to be ...Show All
leshan DataGridView - KeyDown and KeyPress events
I need prevent emergence signs from numeric keypad in cells of DataGridView and rerout their entry at textBox1. This code is solve the task in textbox controls, but at DataGridView no prevent entry at cell, nor from them does pass-off. Does anybody know how to solve this private void dataGridViewOrders_KeyDown (object sender, KeyEventArgs e) { if ((e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9) || e.KeyCode == Keys.Add || e.KeyCode == Keys.Divide || e.KeyCode == Keys.Multiply || e.KeyCode == Keys.Subtract || e.KeyCode == Keys.Decimal) { // Determine whether the keystroke is a backspace. if (e.KeyCode != Keys.Back) { // Set the flag to true and evaluate in KeyPress event. flag = true; } } } private void dataGridView ...Show All
eastside386 Possible to make Quick Info tooltips to show a #defined function?
Is there a way for the 'Quick Info tooltips' to show a function's header when the function's name has been #define'd For example, using the Win32 API function MessageBox(). It is #defined'd as MessageBoxW() depending on some circumstances, so the Quick Info tooltip will show #define MessageBox MessageBoxW when you hold your mouse over it. It there a way for the tooltip to show MessageBoxW's header, when you hold your mouse over MessageBox(), instead of the #define line ...Show All
progames25 Collection Differences
I want a collection for dynamically adding/removing/sorting lists of strings. From what I can tell, the best options are List and StringCollection, but what I can't tell is what exactly the difference would be. They both seem to have many of the same methods, and in the documentation they are both used as examples of Collections that are not prone to performance hits (at least, for my usage). If anyone could explain to me what the difference is, and why I might prefer one to the other, that would be greatly appreciated, as right now I'm very confused, and don't want to start using the wrong one only to have to find that out a while into the programming! Thanks very much! does this mean that 2.0 st ...Show All
AlexBB Debugging Tools
Hi I'm new to the C# area. Please can someone let me know what tools i can use to monitor what resources the application uses, what class/procedures are using up a lot of CPU/memory. Events being fired off. Please let me know the tool Where i can find it What it does Thanks in advance Are there any free ones or ones that come with Visual Studio that are for free thanks There is limited support for code profiling in the following editions of Visual Studio 2005: Visual Studio Team Edition for Software Developers Visual Studio Team Suite See Visual Studio 2005 Team System Editions Comparison . I don't know if there are some free profiling tools available to the community but consid ...Show All
new2vbdotnet #endregion syntax
#endregion allows to place any text in this line, for example: #region Class Members ... #endregion Class Members This is compiled. Is it OK to use this or it is better to use comments: #endregion // Class Members I didn't find anything about this in C# reference. Additional references Damon refers C# language specification v1.x, but here is more recently references C# Language Specification Standard Ecma-334 4 th Edition / June 2006 (PDF file) or ISO/IEC 23270:2006 (freely downloadable zip, whitch contains pdf) , look section 9.5.6 Region control for the same thing as is in 2.5. ...Show All
Chitai Liu Adding text to a listbox
I am trying to add text to a listbox by using a string type variable. During debug I noticed that the variable had the text I wished to add to the listbox, but the listBox1.Items.Add(s_Text); didnt' do anything. Is there a different way your supposed to do this When I try to add it nothing happens, no Exception error or anything. Thanks a bunch! Everything works fine now. should be: this.listBox1.Items.Add( theTextBox.Text ); textboxes are controls, to get or set its textual property, use the "Text" property of the textbox control and most text based controls (combobox, label, textbox etc...) I wasn't talkin ...Show All
panikos Custom Attribute and it influencing all my controls.
Hi, I have a custom attribute in my library (OnOffAttribute, to turn off or on a property) and it's behaving a little oddly. Basically, all my controls use common classes for their drawing and such. I do not always need certain properties in these common classes, so i created an attribute (which is is used through ICustomTypeDescriptor and a custom TypeDescriptor) to do this based on (very vague) information found on the web. The thing is, that if i set, for example, my "DisplayBorder" property to be 'off', it is off for ALL controls that use the common border class instead of just the control i set it to be off for. The border class is always instantiated in each control using the 'new' command and as thus i figured it'd be off ...Show All
Kamii47 Retrieve univocal identifier for Usb port or device
Hi to all, I have some identical SmartCard Reader (Gemplus reader) connected to a usb hub. Each of these has identical vendorId and productID, so I can't recognize which of them I'm using in a determinate moment. I need to associate a device to a port and recognize it: to do it, I need only to obtain a data (code, ID, number, or something else) that can tell me that I'm using a determinate usb port (or device). This code has to be identical indipendently from the reboot of machine or from the adding of other devices. I've tryed to use usblib and I've seen that in the properties of the descriptor I've in "non-public members" a string like this: {[usb_device: filename=\\.\libusb0-0006--0x08e6-0x3437, ...Show All
RaviKanthReddy Library help: a set class needed
Hi I need som tips about finding a library that is implements som sort of a set datatype. That is a collection where all members are unique. Something like the Java languages Hashset implementation: http://java.sun.com/j2se/1.5.0/docs/api/java/util/HashSet.html Thanks Regards .Net Framework have HashTable Class you can look at it http://msdn2.microsoft.com/en-us/library/system.collections.hashtable.aspx No, it's still not what I'm looking for. The Java Hashset does not collect it items through a key/value pair, just values that are unique to each other. It bases its unique list by using a hash in some way (I'm not shure about exactly how), but probably not the most efficient implementation. The meaning behind a Set i ...Show All
