 |
 |
Index ‹ Windows Forms ‹ Windows Forms General
|
- Previous
- 1
- Windows Forms Data Controls and Databinding creating a dataview
I need to take a look at the content of some DataTable(s) I download from SQL Server in a purely debug situation. I decided to use DataView object for it. I improvised the following code:
DataViewManager mng = new DataViewManager ( sqlDatSet ); DataView dtview = mng.CreateDataView ( sqlDatSet.Tables[jj] ); dtview.BeginInit ( );
The jj integer is the index of a particular DataTable in a DataSet and is found in a for loop.
I expected a primitive form with a Table View displayng my records to show up. Is it not a reasonable expectation Nothing like this happened. The DataView remained an internal object. If I cannot get a good look at what is present in the tables I download I will be facing a cumbersome task of printing the stuff out via Console.WriteLine () or DEBUG.
I hope you understand my simple problem. Please help.
Thanks you. (Moderator: Thread moved to this forum for better responses)
- 2
- Windows Forms Data Controls and Databinding Read a value of Datgrid cell...
Hi,
How i can read a value of a cell in DataGridView...
I have 2 different types of columns in my application . If user selects values of all the 2 columns of 1st row & then he presses a button...so on that button click event i have to display value on my form using 3 lables. My columns are of textbox(1st column) & combobox(2nd column) type.
So how i can read these user selected values & display it on form with lable on button click event...
Thanks in advance,
Vinay
- 3
- 4
- Windows Forms General ToolStripMenuItem Shortcut on culture change
Hi
When I change the culture of my application I refresh the menu item's text. But how can I change the shortcut text which stays in the old language.
I tried to remove and set again "ShowShortcutKeys", the "ShortcutKeys" and "Visible" with no success. Invalidate() does also not help. The old language is kept.
Is it really necessary to create a new ToolStripMenuItem object
Thank you for assistance.
- 5
- 6
- Windows Forms General only allow user to select value 1 through 4 from listbox,textbox....?
I want to have the user select/input 6 values. They choose/enter 1,2,3, or 4.
I would like them stacked in a vertical fashion.
These values relate to a character string in a listbox
What is the best way to have these values lined up and limit the choices to 1,2,3, or 4
Thank You
ex: (listbox on the left, value on the right)
_____________
| Some string | 1
| Some string | 1
| Some string | 4
| Some string | 3
| Some string | 2
| Some string | 1
-----------------------
- 7
- 8
- Windows Forms General Bug or By Design In UserControl
The following is my test control.....I does not know why DesignMode propery alway got false, but on OnHandlerCreated Method I got True......Why
public class TestControl:UserControl {
public TestControl() { MessageBox.Show(this.DesignMode.ToString()); }
protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); MessageBox.Show(this.DesignMode.ToString()); } }
- 9
- ClickOnce and Setup & Deployment Projects making a setupfile
I am making a program for a client of ours in Visual Basic Express. The idee is that they put there daily incomes in the program and they send the database back to us. I have tried to make a setupfile through publish. However when I install the program on an other pc, I can't seem to find the database.
Does anyone know where this database should be I have been searching for any mdf-files, but I can't seem to find the one I need.
- 10
- Windows Forms General Key-Based List Control? Hi Everyone,
I was just curious. Is there a Windows Forms List control out there that is "key-based". Basically, I want to display all of my Dictionary items in a List on a form, with the key of each item of the Dictionary being how I access each item in the List.
I've looked at the ListView and ListBox, but it doesn't look like either one would do the trick.
Thanks in advance
- 11
- 12
- Windows Forms General How can I create a tree of control on my Form ?
Hello.
Well, I have a question.
I want to create a tree of my custom controls on my From, whick must looks like a standard tree view (I want to say that I will be able to show or hide nodes and leafes of my tree). What class, standart control or other things can help me to do it
Thanks for help.
- 13
- 14
- Windows Forms Data Controls and Databinding BindingSource updateHi!
I have a problem with the binding. I have a textBox who is binded on an object representing a "User". When i click on a button, it show me a list of User that can be binded on my textbox. So, when I double-click on a item in the list, I want to update the binding of my textBox with the new item selected. The object is updated, but the binding does not refresh automatically.
How can I solved this problem
p.s.: sorry for my poor english...
- 15
- Windows Forms General Webbrowser preventing enter firing
I have created an MDI which can display 2 types of child windows: a) windows form with textbox control (to display text files) and b) windows form with embedded axWebBrowser. If I only display multiple child windows of the file type, then I can click on any part of the window to bring that child window to the front. However, as soon as I also display a webBrowser type window, I can only change which child window is on the top by clicking on the window title bar, regardless of what "type" of window it is i.e. clicking on any other part of the form will not bring that window to the top although I can input data into that child window, even though it remains at the back. Once I have shown a webbrowser type window, the other child windows continue to exhibit this strange behaviour even if I close the webbrowser child.
Strangely, this behaviour is machine dependent - it works fine on one pc but displays the behaviour described above on another. Both are running IE6. I have checked all my internet options and cannot see any obvious difference.
Is anyone able to make any suggestions of how to correct this behaviour or why it is machine specific. I have searched the internet extensively but seen nothing similar reported anywhere.
|
| Author |
Message |
Rocinante8

|
Posted: Windows Forms General, OnClick |
Top |
Hello,
I'm having a problem with a custom control derived from usercontrol. After I put up (and close) a modeless dialog box and then switch parent forms the control no longer generates or receives OnClick events. Other events like MouseDown MouseUp still work.
I'm wondering how the OnClick event is generated (I don't think it is a standard windows message derived event) and if anyone has any ideas how it could be blocked.
Thanks,
Jeff (Moderator: Thread moved to this forum for better responses)
Windows Forms13
|
| |
|
| |
 |
Bhanu Prakash Nunna - MSFT

|
Posted: Windows Forms General, OnClick |
Top |
hi,
Do you wish to block the Onclick event or would you like to raise the event could you please be more clear
thank you, bhanu.
|
| |
|
| |
 |
Rocinante8

|
Posted: Windows Forms General, OnClick |
Top |
Hello,
I want the event to continue to be raised. When my progam starts the OnClick is raised correctly, only after I open/close a modeless dialog and switch forms (the switch is triggered by a OnClick event) does the On Click event stop being raised. I don't understand how/where the onclick event is raised internally so it is hard for me to track this down.
Thanks,
Jeff
|
| |
|
| |
 |
Rocinante8

|
Posted: Windows Forms General, OnClick |
Top |
One additional thing I've noticed is that if I click on the parent form after the modeless dialog is closed, everything works fine. I tried setting the focus and activating the parent form in a Form.Closed event handler but that doesn't work.
Jeff
|
| |
|
| |
 |
nobugz

|
Posted: Windows Forms General, OnClick |
Top |
The OnClick() method for most controls (not all!) is called by the MouseUp message handler. There are a couple of internal control state flags that affect the outcome. One generates the DoubleClick event instead of the Click event. Another checks if the OnValidating event for another control cancelled the focus change. Another checks if the control was disposed. Yet another checks a state flag that I haven't reverse-engineered yet (0x8000000). The most interesting one in your case however is that it calls the WindowFromPoint() API function to map the X/Y mouse coordinates back to a window handle and generates the Click event only if that maps to the same control.
Yet another potentional source of this problem is that a control has captured the mouse. The Button control does that for example. It captures the mouse on the MouseDown event so it can be guaranteed to see the MouseUp event. You'll get in trouble if you implement a MouseDown event handler that will make the window disappear. The work-arounds in that case are to implement the MouseUp event instead. Or set the control's Capture property to false. Or call the ReleaseCapture() API function. If that is the source of your problem, take a good hard look at your code and make sure you properly dispose your controls; you may be leaking windows handles...
|
| |
|
| |
 |
Rocinante8

|
Posted: Windows Forms General, OnClick |
Top |
Hello Hans,
Thanks for the informative reply on how OnClick works. I looked using Reflector but I guess not in the right place. I wish MS would just give out the source code like they do for MFC and ATL...
I'm still not certain of the root cause but using spy I was able to determine that my first click sent a WM_MOUSEACTIVATE message with a LButtonDown as part of one of the parameters. By activating my form after the modeless dialog closes I was able to fix the problem, which may be related to a WindowFromPoint problem.
Another issue was that the underlying control I clicked to initiate the modeless dialog was an ActiveX control. Not sure if this is relevant or not.
Thanks again,
Jeff
P.S. you should put the gist of your reply in the MSDN Wiki
|
| |
|
| |
 |
| |
 |
Index ‹ Windows Forms ‹ Windows Forms General |
- Next
- 1
- ClickOnce and Setup & Deployment Projects validate a serial number from a DLL I am trying to get my project to validate a serial number using a DLL or EXE file I have written instead of the included algorithm, but I have no clue how to get the Customer Information dialog to read from a DLL or EXE file or if it is even possible. I have searched through other threads and haven't found anything extremely useful. I am using Visual Basic .NET and Visual Studio .NET 2003. Can anyone help me with this
- 2
- Windows Forms Data Controls and Databinding combobox selectedvalue vs text question
Is there one method for getting a value in a comboxbox (DropDownStyle set to DropDown) regardless of whether the user entered or selected a value. My combobox is initially populated with a datatable and has a Value and Display member. Since a user can enter thier own value, it would not have a ValueMember, therefore SelectedValue fails. It seems I may have to test the SelectedValue and the Text properties for both validation and saving the data. I was hoping there would be an easier way.
Also, I just noticed that I may not be able to use the DataBinding properties from my bindingsource because if I bind using the SelectedValue, if the value isn't in the list then it doesn't show up. If I use the Text, everything works but I can't leave the control, let alone close the form. It seems to get hung.
- 3
- Windows Forms General Form Opacity Changed -> Component not updatingFirst of all I apollogise for reposting this, but apparently I haven't posted it in the right place the first time. I hope that by posting here I could get an answer. So here goes:
I have created a form, and set the region of the form from a bitmap. On this form I have an PictureBox Component wich is updated by a timer. On the OnTimer Event I have some code that does the following things :
- Gets a region of the forms background and paints it on the control
- Gets 2 bitmaps from two different picture boxes and draws them on control
Everything worked fine until I decided to add the possibility to change the forms Opacity at runtime. The form is shown with 100% opacity at runtime and everything works as it should. When I change the opacity :
this ->Opacity = 0.7;
the form is made semi-transparent but the PictureBox stops updating. The odd thing is that when I hold the left mouse button pressed on the form, the control updates as it should.
I should mention that I have the following code, which is used to move the form, in the OnMouseDown event of the form :
int WM_NCLBUTTONDOWN = 0xA1;
int HT_CAPTION = 0x2;
Win32Calls::ReleaseCapture();
Win32Calls::SendMessage( this->Handle,WM_NCLBUTTONDOWN,HT_CAPTION,0);
I've tried forcing a form redraw at each update, but aside the flicker that it creates on each timer update, when the form is first shown, it has no effect whatsoever when the opacity is changed. One last thing I should mention is that when I change at runtime the Opacity from anything to 100% things work once again.
Thank you for your answers, Dragos
- 4
- Windows Forms General PictureBox control question.
Is it possible to open a multipage Tiff file using the .net 2.0 PictureBox control If not cananyone reccomend a reliable ( and prefferably cheap ) 3rd party control that will
Any help is greatly appreciated!!!
- 5
- Windows Forms General Putting text on an image on a form
I am an old C/C++ programmer that is trying to learn C# and .net. I need to take text from a .txt file and display it on a form in graphics. I eventually need to save the image to a .jpg file.
I created a picturebox (is this the right object to use ) on the main form, opened the .txt file and read in one line at a time. Now I need to put each line of the text into the picturebox area in graphics mode to display it on the screen in the same order as the text in the file.
Any suggestions
Thank you
OldCDude
- 6
- 7
- 8
- Windows Forms Data Controls and Databinding Need some Datagrid help
I have datagrid wih two colums, Name & Role. I just want to the show the datagrid that there role is A. In that column I have a ddl_role list.
if (dgUsersAd.Columns.Equals("A")) //if(dgUsersAd.Columns[1].InitializeCell) { daUsers.Fill(dsUsers1.users); dgUsersAd.DataBind(); } else { lbl_mes.Text = "NO Admin Users".ToString(); }
I tried it this way..but it is not working.
- 9
- ClickOnce and Setup & Deployment Projects Deploying a windows-based applicationI tried to deploy a walkthrough Called " My Notepad" under the title "Walkthrough: Deploying a windows-base application". When I wanted to build the project it failed. It gave me an Error message in the Error Pane saying " Unrecoverable error. I tried several times but I got the same result. I followed the steps accurately. What is the solution Thanks.
- 10
- Windows Forms Data Controls and Databinding List Of Objects As DataSource for DataGridView and DataGridViewComboBoxColumn
Hi all,
I have a DataGridViewComboBoxColumn:
Dim cbCol As New DataGridViewComboBoxColumn
With cbCol
.DataSource = myCatalogoPOS.SubMenus() 'Private _submenus As New List(Of SubMenu)
.ValueMember = "Clave"
.DisplayMember = "Nombre"
End With
------------------------------------------------------------------------------------------------------------------
The DataSource for cbCol is a List of this Class
Public Class SubMenu
# Region "Miembros Privados"
Private _clave As Integer
Private _nombre As String
-----------------------------------------------------------------------------------------------------------------
Also I have a DataGridView(dgvMenu) with its DataSource Property set to:
Using myCatalogoPOS As New CatalogoPOS
With Me.dgvMenu
.DataSource = myCatalogoPOS.Platillos() 'Private _platillos As New List(Of Platillo)
'Insert the cbCol
.Columns.Insert(4, cbCol)
.....
-------------------------------------------------------------------------------------------------------------------------
The DataSource for dgvMenu is a List of this Class
Public Class Platillo
# Region "Miembros Privados"
Private _clave As Integer
Private _nombre As String
Private _nombreboton As String
Private _nombrelargo As String
Private _taxid As Integer
Private _routing As Integer
Private _costo As Double
Private _modificadores() As String
Private _submenu As Integer
Private _precio As Double
.....
---------------------------------------------------------------------------------------------------------------------
How can I make the default value (of every row) for the cbCol of the dgvMenu to be the value of the SubMenu(_submenu) Property of the Platillo Class
- 11
- 12
- Windows Forms Data Controls and Databinding cannot view data in datagridview
I've tried using the code below to view data from a select query in a datagridview control (along with several other methods) with no success. It is slightly adapted from a BOL example. The bindingnavigator appears to be reading the bindingsource ok (shows correct number of records) however, the datagridview remains blank.
Private Sub GetData(ByVal selectCommand As String, ByVal connectionString As String)
Dim VwTblDataAdapter As SqlDataAdapter
Try
' Create a new data adapter based on the specified query.
VwTblDataAdapter = New SqlDataAdapter(selectCommand, connectionString)
' Create a command builder to generate SQL update, insert, and
' delete commands based on selectCommand. These are used to
' update the database.
Dim commandBuilder As New SqlCommandBuilder(VwTblDataAdapter)
' Populate a new data table and bind it to the BindingSource.
Dim table As New DataTable()
table.Locale = System.Globalization.CultureInfo.InvariantCulture
VwTblDataAdapter.Fill(table)
Me.BindingSource2.DataSource = table
' Resize the DataGridView columns to fit the newly loaded content.
Me.DataGridView2.AutoResizeColumns( _
DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader)
Catch ex As SqlException
MessageBox.Show( "To run this example, replace the value of the " + _
"connectionString variable with a connection string that is " + _
"valid for your system.")
End Try
End Sub
- 13
- Windows Forms General TreeView in User Control does not display initialized data
Hi -
I've been working on this most of the morning... I've created a Windows Form User Control that has a TreeView control. This user control is dropped onto a tab control in my main form. I initialze a TreeView node in the main form constructor as follows ...
MyUserControl myControl = new MyUserControl();
In the user control constructor, I create a node as follows...
MyUserControl() { treeView1.Nodes.Clear(); treeView1.BeginUpdate(); treeView1.Nodes.Add(new TreeNode("Hello, node")); treeView1.EndUpdate(); }
The node that I create - "Hello, node" - does not display in the treeView of my user control on my main form. I did two "sanity" checks... First, I can populate the user control treeView1 with manual data from the smart tag. This shows up on the main form (although I expected to see my "Hello, node"). Second, I created a "treeView2" in my main form. I used the same code to load "Hello, node" as above and this worked.
Setting a break at treeView1.EndUpdate() shows "Hello,node", as expected, but again, this does not show up on my main form user control. I've tried various techniques from other googles -
myControl.Enabled = false; myControl.Enabled = true; myControl.Refresh();
- all no joy.
Thanks, Mike
- 14
- 15
|
|
|