Answer Questions
Stuman99 Getting value from DataGridView Combobox column
I have combobox column type in a datagridview. I have given some datasource, datavaluefield and datamember field. Now once the comboxbox is selected, for each row i want datavalue corresponding to that selected item of combo box. Please help. Gaurav try follow code, can change column2 value according column1 selected item changed private void button1_Click( object sender, EventArgs e) { MyGenTable TBC = new MyGenTable (); DataGridViewComboBoxColumn column_c = new DataGridViewComboBoxColumn (); column_c.DataSource = TBC.get_TBA(); column_c.DisplayMember = "Name_TBA" ; column_c.ValueMember = "ID" ; col ...Show All
IceAngel89 Find width and length of an image w/0 loading it
Is there away to find the width and length of an image without loading it I can't use this method because it loads the image: static void GetDimensions( string imagePath, ref int height, ref int width) { width = System.Drawing. Image .FromFile(imagePath).Width; height = System.Drawing. Image .FromFile(imagePath).Height; } I am having the same problem. Does any have an sample code that streams the image in and reads the metadata I am struggling with this and any help would be greatly appreciated. I don't think you can generically escape loading the image. For some image types, there might be metadata that you can access by ope ...Show All
Yacob3 Working with Datasets & DataGrids
Hello there. I am working on datasets and datagrid tables and having some difficulty. I want to read some information from a file and place it in the table for different coloumns the command i was using to add information to a row of dataset was dataset1.tables(table1).rows.item("field1") = newvalue but this doesnt work. my aim is to add a new value for each of the coloumn in the table and move to the next row, then repeat the same process to add some more new values for that table. Also, in excel i can add a hyperlink to a cell if i want.i know the excel command for adding hyperlinks to a cell....can i do the same for dataset tables also.If yes,..then how , I want to add a hyperlink to point to a file.. c ...Show All
ricky rich How do you make a Favourites Menu
hi, Iwas just wondering if anyone could tell me how to make a favourites menu from scratch and how to program it in C#. Thanks, Zulbaric If you are talking something abuot Faveourites like in Internet explorer i.e open Some website and add it to favourites. You have to place a button on your GUI which opens up a Windows similar to Internet explorer, with a Save button and a TextBox with Title of Favourite, Put a title for the favourite and internally save the path of opened file along with the title in some text file, xml file, Registry or application settings.... Then on the GUi create a menu which loads its item from those saved favourites and put their event handlers respectivley to open up tho ...Show All
Craig G Selecting a control from the form's control collection
I have spent the past several hours trying to see if this is possible, and trying to find some example code, without much luck. What I want to do is this: I am creating a base form that other forms in my project will inherit from. This base form will need to do some special handling on controls in the subclassed form (so for example, the base form will need to know "Ok, I need handle that Panel/Lable/etc.") I would like the base form to be able to expose a property that I can edit in the designer, similar to the "ContextMenuStrip" property where I can choose from a list of controls. I have investigated various UITypeEditors but it doesn't seem like that's the way to go - I would need to pass the editor a *Colle ...Show All
Miles100 Splitter control on event
I am trying to figure out a way to design a winform that allows me that on the left side to select a button, and on the right side of splitter, to load another winform or user control. Is there a way to facilitate this Basically, the form would be invoked by the user, and have a default screen showing a splash image on the right side of the splitter control, and on the left side would be a collection of buttons. When the click event is raised on one of the buttons, the other side of the splitter would switch to either a seperatly designed user control. The purpose of this is I am trying to consolidate the amount of windows that are opened in our in-house application. basically everything that is clicked right now brings up a new window an ...Show All
brad1 How to get a enumeration of all textbox or other input fields
I want to disable or make all input field read at runtime... What is the best way THANKS Peter You need to do this recursively ... in other words, if your control is a tab control, then you need to iterate through each of *it's* controls. foreach ( Control c in controlcol) { if (c is TextBox ) { (( TextBox )c).ReadOnly = !enable; (( TextBox )c).ForeColor = System . Drawing . SystemColors . WindowText; else c. ...Show All
israelsaba inherited forms, something missing
Hi, I'm playing around with inherited forms but I'm somewhat confused. I build a normal Windows Application (vb.net2005) and added a baseform to it. Added some buttons as shown in the Walkthrough and added some code to the button_click events. Finally I builded the project. So far so good. After adding a new inherited form (called testForm) based on my baseform I can add and change properties for the buttons. However the code I added is not there and so when I click the buttons on my testForm nothing happens. Clearly I'm missing something but I don't see what. Anyone Cheers, Frank (crossposted in Windows Forms Designer, sorry for that) The access modifiers only enable you to view or access ...Show All
ooboyle DragDrop
Hello I have a problem with dodragdrop function. When i add DoDrapDrop function to the MouseDown Event the Click and DoubleClick events are not triggered anymore. I created a new control derived from usercontrol. Does anyone knows how to solve this. Thanks, Jan private void picThumbnail_MouseDown( object sender, MouseEventArgs e) { Control source = ( Control )sender; source.DoDragDrop(source.Text, DragDropEffects .None); lblFileName.Text = "dragdrop" ; } private void picThumbnail_DoubleClick( object sender, EventArgs e) { lblFileName.Text = "double" ; // not executed when double click the control } ...Show All
Flecko1 checking primary key @ user input
hi guys My newbie problem is simple: a table is bound to a combobox(accepting 6-7 numbers) & I want to warn the user in case a duplicate input happens upon pressing the save button of the bindingnavigator.... I'm thinking of a query with count(*) + combobox input checking :.... however I cannot fully figure this out. (no code is needed for the saving-updating process-it is done, but an idea for the above) thx in advance g no way auto increment is not enough. As mentioned earlier a 6-7 digit is needed (user should know the number). However I made a "solution": I catced the exception & show up an msgbox.... Still, interested in a loop which goes through the table datas & compare it with the t ...Show All
Vayse_Dev creating an event to fire when a variable changes
I am sorry for the maybe silly question. I want to execute an event when the value of a variable changes to a specific value. for example dim x as boolean x = true (do event) x = false (do nothing) How do I do this Thanks. if (x == true) { // Event // ... } else if (x == false) { // Do nothing // ... } You cannot do this, per se. In your example, the boolean type would have to support such an event, and it does not. If you can create your own class for this, you could certainly create a MyBoolean class that first a ValueIsTrue event whenever the value is assigned to true. To do this, make a Value property in the class that, and fire the event from the set { } accessor whenever true. Not ...Show All
Jamesx Slow painting, flickering on complex forms
Okay, I've tried double buffering (Control.SetStyles et al). I've played around with Win32 APIs such as SET_REDRAW and LockWindowUpdate, but I cannot get rid of the apallingly slow painting that is Windows Forms. Try this: Create a form with about 50 labels on it. Make the BackColor of the form the usual windows grey - and leave the labels as is. Run the app. Alt-Tab back and forth from another app (preferable one with a white background - such as MS WORD). On my (average spec) PC there is a noticeable flickering and you can actually see each label paint its background first white, and then grey. What am I doing wrong - or is Windows Forms just reaaaaal sllloooowww when painting forms with any complexity Help ...Show All
Ayala24 Include the parent control when a child is cut / copied and pasted.
Hi all, This is the final step in what became a rather involved process. The big picture is that I need to present a container control at design-time which does NOT clip its children. So yeah, I want for instance a child button control to be able to draw beyond its parent's bounds. I've gotten it to work by implementing an "envelope / hub" mechanism, where the hub is the above-mentioned container, and the envelope is its parent, another container which sizes itself to envelop the hub. When the user needs to "float" (ie. un-clip) the child button, it gets re-parented to the envelope and now has free reign to paint over the hub's bounds. All that to say, I have one final problem: when the hub is cut to clipboard, ...Show All
DavidR100 I use the print class of FotoVision to make a image print program, why doesn't it work?
The following code is from FotoVision, I make a image print program using the class, but it doesn't work. Only after I have installed the FotoVision (The name of setup program is " FotoVision Desktop.msi ") my program just work. I think that FotoVision have packaged some other components such as dll or registered photowiz.dll in its setup program, but I'm not sure. If so, how can I register photowiz.dll with C# Could you help me, thanks! // Uses the XP Photo Printing Wizard to print one or more photos. // The implementation of the photo wizard is in photowiz.dll but the // interface is not exposed. Instead, Microsoft provides the Windows // Image Acquisition Library (WIA). // // Use late bind ...Show All
testorp DoEvents in a Class Library
Hi, I have a VC# dll which has a while(true) loop. I was using a DoEvents in the original code, but now when I write the dll I cant use the DoEvents !! Is there a way to use DoEvents in a Class Library Thanks. I agree with the sentiments expressed that "DoEvents()" is a problem. Since we don't have any sample code to look at, it is difficult to diagnose why a so-called "while (true)" loop may be degrading performance. It sounds to me like a busy-wait problem, but with no code it's impossible to say. There are no circumstances that I can think of where DoEvents() is necessary. In fact, the overhead of calling DoEvents() is HUGE. We treat the use of DoEvents() as a bug here... IMHO the solution t ...Show All
