Answer Questions
nic101 If datagridview.Col = 0 Then
With datagridview.Rows If datagridview.Col = 0 Then ...... how do I test to see if the current datagridview's column is zero thx. -greg and how can I set the column thx. thx. -g try this: handle the cell enter event of the dgv. As soon as you enter cell(0) of any row, the row is selected. and it also works when you control+select rows by selecting the first cell of rows. Private Sub DataGridView1_CellEnter( ByVal sender As Object , ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter If (e.ColumnIndex) = 0 Then Me .DataGridView1.Rows(e.RowIndex).Selected = Tr ...Show All
Warren13 Runtime-only properties?
Exactly how do I create a property for a class (specifically an inherited class from Textbox) that is runtime-only i.e. it doesn't show up in the properties grid during design-time Since the get requires use of other runtime-only properties (such as SelectionStart) and really only applies during runtime (it get's the line number that the carret is on) I know there must be some way of doing it. Thanks in advance for any help. This post is off topic for the Visual C# Language forum, moving to Windows Forms Designer forum. You want to append the BrowsableAttribute to false. E.g. [Browsable(false)] public String GetMeAtRunTime { get { return "Hello"; } set { } ...Show All
vimalbharathi Moving Control at runtime not working properly
I'm trying to move a button control at run time with the intent of having the control act exactly like moving a button control does in the designer. When I click on the control and attempt to drag it across the form it disappears and then pops up in a different place on the form from where it was dragged to. Can someone please tell me what is wrong with the code public partial class Form1 : Form { private bool dragging = false ; public Form1() { InitializeComponent(); } private void button1_MouseMove( object sender, System.Windows.Forms. MouseEventArgs e) { if (dragging) { button1.Location = new Point (e.X, e.Y); } } private void button1_MouseDown( object sender, Sy ...Show All
Chris0144 Problems with PrintPreviewDialog
I have the following code: try { printPreviewDialog.ShowDialog(); } catch (InvalidPrinterException e) { MessageBox.Show(e.Message); } When it runs on computer where no printers installed, I get error message as expected. But when user selects the same function second time, the following exception is shown: System.InvalidOperationException: Form that is already displayed modally cannot be displayed as a modal dialog box. Close the form before calling showDialog. printPreviewDialog is the same instance as in first call. I can solve this problem by disabling menu item, using another dialog instance or handling InvalidOperationException. But I want to know right way to do this - how to cancel running dialog, which is still active, ...Show All
jesus m windows forms
how come when i use this.hide on a certain event then when i load this.Activate() on the form_load event , it will not load back the form that i hide.... what want to do is when user go to the other form hide the current form and when user close the form show back the form that has been hide.. how can i solve this ming1127 wrote: i try the show dialog it seems that it just close it and never show back the previous form below is my code: this.Hide(); Employees emp=new Employees(); emp.ShowDialog(); when it show the emp form and i close it, it wouldn't show back the previous form Add one line: this .Show(); after the emp.showdialog(), and it didn't work i try the show dialog it ...Show All
AndersBank VB2005 Check cells of DataGridView for content
Hello, How do I check if the cells of a DatagridView are filled with a certain type of data or are empty Thanks in advance. thanks. I tried this but I get the error that the columname is wrong. Me .TblBetalingAanMedewerkerDataGridView.Rows( Me .TblBetalingAanMedewerkerDataGridView.CurrentRow.Index).Cells( "datum" ).Value = System.DateTime.Now 'Datum' is the exact columnname. well you can go to the specific row and cell and get its value, check to see if its empty (DBNull.Value) if theDataGridView.Rows( index ).Cells( ColumnName ).Value = DBNull.Value then 'cell value is empty else 'cell value is not empty, so check whate ...Show All
rcook349 J# request while installing a deployment project
Hi, I have prepared a deployment project for my C# project, but when i ran the setup, setup request VS J# redistributable package although I havent used J#. Why was this problem occured and how can i solve this thanks thanks and I think you were right, one of the dlls that i am using might be written in J#.. but now the problem is, how can i deploy J# redistributable package with my program Weird. I would check the prerequisites and make sure J# is not selected. There was a bug in the Express products where there was an incorrect J# item listed. Another thing to check is whether you have any referenced .DLL's that are built using J#. ...Show All
Coryc Custom Collection Editor - how to block the up and down buttons ?
I have a Custom Collection Editor and overridden some methods - everything works fine... BUT I now want to block the up and down buttons, so the User won't be able to move the Collection Items within the Index. Is there any possibilty by overriding a method so it won't move the collection items To make it clear - I do not want to remove the buttons or make them invisible, I just want to block the functionality. Thank you in advance, Robert. Really no one any idea Please help me! Moved to Windows Forms Designer forum. ...Show All
djjdaeja Help Creating Bold Text...
Ok, the problem I'm having is thet when I select my text and click my BoldButton, no matter what my selected text font or text size is set to, it reverts it back to 'Microsoft Sans Serif, 8.25 pt' Here is my code: If (Color.op_Inequality( Me .BackColor, SystemColors.ControlDark)) Then Me .BackColor = SystemColors.ControlDark End If If Not ( Me .Font.Bold) Then Me .Font = New Font( Me .Font, FontStyle.Bold) RichTextBox1.SelectionFont = Me .Font Else Me .Font = New Font( Me .Font, FontStyle.Regular) RichTextBox1.SelectionFont = Me .Font End If RichTextBox1.Focus() I know it has to be a simple fix...........Thanks for your reply. Here ...Show All
Futzy RichTextBox control hosted in Datagridview cell - properties question
I uSed the infamous calendar code example and hack the hosted control to derive from richtextbox instead of datetimepicker; http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=792064&SiteID=1 I hosted the RTB control so that I could use the .SelectedStart and .SelectedLength properties to determine cursor position in the cell. However, I can't seem to find a way to pass the property from the RichTextBoxEditingControl to the RichTextBoxCell that I created. Anyone done this before Is it possible I can post my code if it's helpful , although it's almost the exact code from the post above.... The richtext box does not have an onvaluechanged procedure to override. You should override the ontextchanged event instead. ...Show All
toneho C# Form takes long time to close (Refresh!)
Hi All, I have Windows application with one form, which calls Dll (windows control lib) to get user name and password and do the authentication. After successful authentication, the control comes to main form, from there which does few database queries to load the grid control. The problem is here, after successful login authentication, the login form does not getting closed while loading the grid control from the main form. The login control exists till we the grid control loads the data. Is there anyway I can avoid this. (I don't want to do this with threading or backgroundworker, because of grid scrollbar problem) Thanks for any suggestion/thoughts. Thanks Keith. Here is the code and I appreciat ...Show All
fulish1 System.UriFormatException Problem
Hi folks. I'm having a problem with a line of code that's throwing the above exception (System.UriFormatException) in my Windows Form application (VS 2005, C++): spToolClick = gcnew SoundPlayer( "toolclick.wav" ); The spToolClick object is a member of the Form1 class. If I comment this line, the application stops throwing the exception. If I leave it in, the app throws the exception, but continues to run - and is nevertheless able to later play the sound that I reference ("toolclick.wav"). The exception is only visible in the debug output of Visual Studio. Even though the exception seems harmless, I'm just wondering what is causing it & what I should do about it Zero & ...Show All
regthesk8r Delete a row programmatically in DataGridView
How can I delete a newly added row with code in a DataGridview I cannot find any delete method in any of the features of the DataGridView. I test for correct data in the _RowValidating event that sets cancel to true. But when the user leaves the row without correcting the value, I set e.cancel = True. But the row is still there with the invalid value in one of the cells. I want to delete the row if the data are not correct and the user navigates away from the row. Can this be done Is RowValidating event the correct place to do the delete How and where should I do it The DataGridView is bound to a binding source which is in turn bound to a datatable. There is no delete method in the binding source and the record does not e ...Show All
enric vives ListBox with images
Hey, How do you make a listbox show a 50x50 .PNG image and have text under the image Thanks :) Well, you know how Internet Explorer in it's security settings in Internet Options has those 4 images in a listbox and then has words under them, that is what I am trying to do. The msdn one was really strange so I am not gunna use that but the other one, I guess I will try that one... Thanks :) EDIT: I tryed doing the other one but I gould not really get it to do what I wanted. So I tryed tree veiw but the images cant be resized, they stay small, so is there any other way Thanks :) Are you trying to copy something like Windows File Explorer, where there are lists of direct ...Show All
Kurt CLAEYS image transparent background
I want to add an .bmp image to a label. The image has a transparent background. When I add the image the transparent part becomes white. How can I add the image to the label in a way that the background will not turn white. thanks you should change the picture to png-24 . If you're not using an image format that supports transparency (like .gif or .png), you need to make the image transparent yourself. For example: private void Form1_Load(object sender, EventArgs e) { Bitmap bmp = new Bitmap(@"c:\temp\test.bmp"); bmp.MakeTransparent(Color.White); label1.Image = (Image)bmp.Clone(); bmp.Dispose(); } thanks. I tried using a .png image and I still had the sa ...Show All
