 |
 |
Index ‹ Windows Forms ‹ Windows Forms General
|
- Previous
- 1
- Windows Forms General 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.
- 2
- Windows Forms Data Controls and Databinding combobox cell in DataGridViewHi,
I am using the DataGridView control in one project and have a small problem. I have defined a combobox for one cell, and populate predefined values in it, but how can i get the combox's current listindex without going through all of its values say the combobox is in the cell : DataGridView1(1,2), i couldn't find any property to tell me which index value the combobox is currently showing.
- 3
- Windows Forms Data Controls and Databinding Populating Serial No Problem
hi i have a datagrid, and i have binded it to a dataset, i have a column called srno and its autogenerated, it works fine,
the problem is when i enter the data for the first time in a row the srno is 1, after entering the data i navigate to the second row, at that time srno is 2, before entering the data in the 2nd row do some alterations in the first row, after finishing alterations in the 1st row i return back to the 2nd row, and suprisingly the srno is now 3,
need help
thanks
Prasenna
- 4
- 5
- ClickOnce and Setup & Deployment Projects Dynamically created Registry Keys in .NET InstallerHi,
I have written a Windows Forms Application in Visual Studio 2005 (VC++). I have created a Setup Project in my solution and am configuring it. My application uses registry values, and so I am entering the Registry Keys and Values needed by my app in the deployment Registry Editor within Visual Studio 2005. I use several Values whose data is a filename or path, but that path depends on the selected install folder the user chooses while installing the program (using this Setup program I am creating.) My question is, is it possible to use some sort of variable while specifiying the value for a Registry Value in the Registry Editor And if it is, how do I get the Root Target Folder for the installed application Thanks -
Samy
PS. It occurs to me that I may be doing this all wrong, that maybe I should be using some class in the .NET Framework to dynamically retrieve the root target folder everytime my app runs instead of storing that in the registry, but I could not find any such class (or property or method). The only one I know about can change when an Open/Save FileDialog sets a new path.
- 6
- Windows Forms Data Controls and Databinding adding 10,000 rows into a DataGridView takes 10 seconds
I am adding 10,000 rows into a DataGridView with 50 columns, this takes 10 seconds - 6 seconds to add rows and 4 seconds to set initial values. :(
What is interesting - setting 2nd column values takes NO time
SuspendLayout does not help, there is no BeginUpdate method...
Any trick to improve
here is an example of my output:
now only adding rows 11/30/2006 3:56:05 AM now setting 1st value 11/30/2006 3:56:11 AM now setting 2ns value 11/30/2006 3:56:14 AM done! 11/30/2006 3:56:14 AM
here is the code:
int c = 10000;
dataGridView1.SuspendLayout(); Debug.WriteLine("now only adding rows " + DateTime.Now);
for (int i = 0; i < c; i++) { dataGridView1.Rows.Add(); }
Debug.WriteLine("now setting 1st value " + DateTime.Now); for (int i = 0; i < c; i++) { dataGridView1.Rows .Cells[1].Value = "val 1 " + r.Next(); }
Debug.WriteLine("now setting 2ns value " + DateTime.Now); for (int i = 0; i < c; i++) { dataGridView1.Rows .Cells[3].Value = "val 2 " + r.Next(); } dataGridView1.ResumeLayout(); Debug.WriteLine("done! " + DateTime.Now);
- 7
- Windows Forms Data Controls and Databinding need to trap space bar
Hi,
I need to pop up message while pressing non numeric character in numeric(bound) field of datagridview ctrl.
I'm using dataerror event. I get error message properly for all non numeric keys. for delete key i dont get error message.it just deletes the data in the cell. but if i press space bar my message from dataerror is showed. I just want , not to show this message and to delete the data. I want the space bar to work like delete key.
private void dgrid_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
MessageBox.Show("Please type Numeric value in the selected Column");
}
venp---
- 8
- Windows Forms General menu item and AddHandler?
Ok, new problem.
I can not find where I did this before.
Dyamically adding menu items:
string sql = "Select * From myTable";
OleDbConnection conn = getDb();
conn.Open();
OleDbCommand myCommand = new OleDbCommand(sql, conn);
OleDbDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
while(myReader.Read())
{
mnuView.MenuItems.Add(myReader[0].ToString());
}
myReader.Close();
I need to add a handler to each menu item for a click event.
Check/uncheck and other actions I already have written.
It's like right on the tip of my mind, but just can't see it... must be late.
Thanks,
Zath
- 9
- ClickOnce and Setup & Deployment Projects Interop.Word.dll System can't find file
I have an app that I have created an installer. Within the app I have some mail merge capabilities. All machines in our office use Office 2000(9.0). So I am using Interop.Word.dll. All works well in the VS 2005. The package installs fine with no errors. Everything in the app works fine until they go to do a mail merge. Then I get the following errors:
************** Exception Text ************** System.IO.FileNotFoundException: Could not load file or assembly 'Interop.Word, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'Interop.Word, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null' at MTM.Classes.clsCrspUI.tsbtnPrintPreview_Click(Object sender, EventArgs e) at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
************** Loaded Assemblies ************** mscorlib Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll ---------------------------------------- MTM Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Program%20Files/Mihlfeld%20%26%20Associates,%20Inc/MTM%20Installer/Output/MTM.exe ---------------------------------------- System.Windows.Forms Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Drawing Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System.Data Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll ---------------------------------------- System.Xml Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- System.Configuration Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll ---------------------------------------- System.Transactions Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll ---------------------------------------- System.EnterpriseServices Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.42 (RTM.050727-4200) CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll ----------------------------------------
************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.
For example:
<configuration> <system.windows.forms jitDebugging="true" /> </configuration>
When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.
I have used the gacutil.exe for .net 2.0 and I get the following error:
"Failure adding assembly to the cache: Attempt to install assembly without a strong name"
I am completely stumped....can anyone help.
Thanks!
Curt
- 10
- 11
- Windows Forms General Is there a way to get print preview information from web control?
Hi Folks,
I have a win forms application used in the aviation industry with a very customized UI.
I'm using a web control to display some HTML docs within the forms app. I'm trying
to build in some print preview functionality. The print preview dialog UI has to match
the app's look and feel.
Does anybody know how I can get print preview info from the web control Info such as
number of pages. Better yet, if I could get some sort of a collection of page objects, that
would be just grand.
Thanks much,
Jake
- 12
- Windows Forms Data Controls and Databinding TableAdapter Wizard w/ optimistic concurrency @IsNull_ params invisible to ObjectDataSource
For the past few months we have be using the TableAdapter wizard to generate Procs with optimistic concurrency under these procedures, running Visual Web Developer Express, C#:
a) Table has a primary, autoinc identity key b) Set objectdatasource.conflictdetection = CompareAllValues in the ODS for the DetailsView c) Change ID field readOnly from True to False in DetailsView, per http://www.geekzilla.co.uk/ViewF9581DAE-CCF8-49FF-844C-7498603E0005.htm
Then we hit this roadblock: This table has 5 NULLABLE fields. The wizard generates the UPDATE PROC with TWO additional params:
@IsNull_Disposition nchar(10), @IsNull_OwnerDiv nvarchar(50),
The objectDataSource does not add these params, so the mismatch causes the "Update not found" exception.
Comments welcome. We have burned weeks on these wizards and hope some patch is forthcoming. This is close to being awesome.
BTW the Wizard should also create a _SelectByPrimaryKey PROC, which we manually do by tweaking the generated _Delete proc.
Kim
GO /****** Object: Table [dbo].[Applications] Script Date: 11/29/2006 13:13:46 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Applications]( [App_ID] [int] IDENTITY(1,1) NOT NULL, [Application] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Disposition] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [OwnerDiv] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [Purpose] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [Technology] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [Comments] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, CONSTRAINT [PK_Applications] PRIMARY KEY CLUSTERED ( [App_ID] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]
TableAdapter Wizard with optimistic concurrency generates this:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[usp_dsPat_Applications_Update] ( @Application nvarchar(50), @Disposition nchar(10), @OwnerDiv nvarchar(50), @Purpose nvarchar(MAX), @Technology nvarchar(MAX), @Comments nvarchar(MAX), @Original_App_ID int, @Original_Application nvarchar(50), @IsNull_Disposition nchar(10), @Original_Disposition nchar(10), @IsNull_OwnerDiv nvarchar(50), @Original_OwnerDiv nvarchar(50), @App_ID int ) AS SET NOCOUNT OFF; UPDATE [Applications] SET [Application] = @Application, [Disposition] = @Disposition, [OwnerDiv] = @OwnerDiv, [Purpose] = @Purpose, [Technology] = @Technology, [Comments] = @Comments WHERE (([App_ID] = @Original_App_ID) AND ([Application] = @Original_Application) AND ((@IsNull_Disposition = 1 AND [Disposition] IS NULL) OR ([Disposition] = @Original_Disposition)) AND ((@IsNull_OwnerDiv = 1 AND [OwnerDiv] IS NULL) OR ([OwnerDiv] = @Original_OwnerDiv))); SELECT App_ID, Application, Disposition, OwnerDiv, Purpose, Technology, Comments FROM Applications WHERE (App_ID = @App_ID)
Bind the objectDataSource and it does not find those params:
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" ConflictDetection="CompareAllValues" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="dsPatTableAdapters.Applications1TableAdapter" UpdateMethod="Update"> <UpdateParameters> <asp:Parameter Name="Application" Type="String" /> <asp:Parameter Name="Disposition" Type="String" /> <asp:Parameter Name="OwnerDiv" Type="String" /> <asp:Parameter Name="Purpose" Type="String" /> <asp:Parameter Name="Technology" Type="String" /> <asp:Parameter Name="Comments" Type="String" /> <asp:Parameter Name="Original_App_ID" Type="Int32" /> <asp:Parameter Name="Original_Application" Type="String" /> <asp:Parameter Name="Original_Disposition" Type="String" /> <asp:Parameter Name="Original_OwnerDiv" Type="String" /> <asp:Parameter Name="App_ID" Type="Int32" /> </UpdateParameters>
- 13
- 14
- Windows Forms General Format MessageBox Text
Using VS.Net 2003
Yes, haven't upgraded here at home yet, only at work... cost $ :P
But, not sure if this is possible.
A MessageBox:
string message = "Delete " + lblTitle.Text.ToString() + " ";
MessageBox.Show( this, message,.............);
Is if possible to format the lblTitle.Text above
Bold, underline, color, or anything will do.
Thanks,
Zath
- 15
|
| Author |
Message |
ivanFSR

|
Posted: Windows Forms General, Control textbox, promtly |
Top |
How I can limit textbox control
So, when I must input decimal number, but, if I make mistake and input text or integer, system must alert me that I can input onli decimals numbers. I know for maskedtextbox. Dou you have another choice.
Please help me and thx.
Windows Forms9
|
| |
|
| |
 |
SvenC

|
Posted: Windows Forms General, Control textbox, promtly |
Top |
|
| |
 |
David L

|
Posted: Windows Forms General, Control textbox, promtly |
Top |
Well, a MaskedTextBox would really do the trick.
However, if you don't want to use that, you could validate the user input with a regular expression for example when the control leaves focus. Something like the following:
private void textBox1_Leave(object sender, EventArgs e)
{
if (!Regex.IsMatch(textBox1.Text, @"\d[.,]\d"))
{
MessageBox.Show("Invalid!");
}
}
This would show a messagebox if the text in textBox1 doesnt contain [numerical value] , or . [numerical value]. In other words a decimal number (allowing both . and , due to cultural differences).
|
| |
|
| |
 |
ivanFSR

|
Posted: Windows Forms General, Control textbox, promtly |
Top |
Thx you SvenC but it's very complexly for me, I am beginner. So I need something what I can use very fast, and very simple.
|
| |
|
| |
 |
boban.s

|
Posted: Windows Forms General, Control textbox, promtly |
Top |
NumericUpDown is also a good choice.
|
| |
|
| |
 |
ahmedilyas

|
Posted: Windows Forms General, Control textbox, promtly |
Top |
one other way would be to implement a textbox keypress event, then check to see if the key pressed is a number, if it isnt, handle the event (cancel imput)
private void textbox1_keypress(object sender, KeyPressEventArgs e)
{
if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
{
e.Handled = true;
MessageBox.Show("Only numeric input please!");
}
}
this will allow you to also use the backspace/delete keys. It's also cheaper than regex which is a key
|
| |
|
| |
 |
| |
 |
Index ‹ Windows Forms ‹ Windows Forms General |
- Next
- 1
- ClickOnce and Setup & Deployment Projects Getting the MSI Package Path from a custom actionHello,
I need to add licensing functionality to a MSI Package. The package should be shipped together with a license file which will be evaluated by a custom action. The problem is that the current directory in the custom action seems to be the system32 folder. Does anybody have an idea how to access the folder where the MSI package actually is situated from the custom action
Thanks in advance Gerald
- 2
- Windows Forms General how to create a resizable custom controlI need to create a resizable custom control. I inherit from usercontrol and create an handler for the OnPaint event, then I need to detect when cursor is over the edge of the control (a simple rectangle) and if the left button is pressed and the mouse dragged, resize the control.
I read about using drawgrabhandle method but I'mnot sure what this method does. Can someone help me
- 3
- 4
- 5
- 6
- 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...
- 7
- Windows Forms Data Controls and Databinding Using OpenfileDialog and combobox controls in Datagridview cell.
Hi,
I want a DataGridView to have 2 columns named Key and Value.Some rows should have the Value column to be a ComboBox and another row to have Value Column as OpenFileDialog and the rest to be textbox.The values in the combo box are predefined and the rows are also predefined. Below is the sample.
Key Value
1. SampleKey1 SampleValue1 (CellStyle:TextBox)
2. SampleKey2 true (CellStyle:ComboBox with items as true,false)
3. SampleKey3 Folder Path (CellStyle: OpenFileDialog)
4. SampleKey4 SampleValue4 (CellStyle: TextBox)
- ---- (CellStyle: TextBox)
- ---- (CellStyle: TextBox)
- --- (CellStyle: TextBox)
Please provide the help on the same.
- 8
- Windows Forms Data Controls and Databinding Assign Value to unbound DataGridViewComboBoxColumn
Hi, i have a problem vith comboBoxColumn. i want to assign a value
to unbound comboBox cell and when i change its index want it to fire an event. I use CellFormatting event to assign value like below
private void dataGridView1_CellFormatting(object sender,DataGridViewCellFormattingEventArgs e)
{ //(unVisibleSourceColumn is unvisible and belongs to bound dataset)
if(dataGridView1.Columns[e.ColumnIndex].Name.Equals("comboColumn")) {
e.Value = Convert.ToString(dataGridView1.CurrentRow.Cells["unVisibleSourceColumn"].Value)}
}
At that point, assign unVisibleSourceColumn's value to combo just for new row . Registered SelectedIndexChanged event for combo in EditingControlShowing . The code in combo_SelectedIndexChanged is below
private void combo_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateDataSetsUnVisibleSourceColumnValue()
// here just updates value of currentRows unVisibleSourceCells value for bound dataset
}
After this, the program seems to enter infinite loop because of CellFormatting (P4 CPU %100 and crashes)
My question is, why it calls CellFormatting continuously except just one time and if anyone have suggestion for that case:
datagridView is bound to a dataset, an unbound DataGridViewComboBox is added, want to add first value
to combocell according to sourceColumn in dataset and when changing index of it, updating sourceColumn value. Thanks to everyone..
- 9
- Windows Forms Data Controls and Databinding menu strip and mdi in vb 2005
hi,
i am using visual basic 2005. i have an mdi parent form and i added a menu strip for that with 2 menus.
forms-form1,form2, form3(sub items)
and reports-report (rpt 1, rpt 2...)
i wrote code to display form 1, form2...when i click on each form.
form1, form2 etc are other forms in the application and i set the window state to maximised for all and ismdichild property to true.
when im running the application when i click on each menu item, the corresponding form is getting diaplayed, but it the menu items are not displayed. i mean the forms are not coming as child forms. i have to close the form1 to see mdi form.
how can i solve it
Binu
- 10
- 11
- ClickOnce and Setup & Deployment Projects Web Publishing with multiple connection strings
Hi,
We have two environments available to all users, one for testing and user training, pointing to a database and a live environment pointing to another database. A third is on the developer machines and we all have our own DB running locally. I publish to two different locations for users (live and test) and two links on the users desktop point to either environment, which need different connection strings.
Here's my problem:
Before publishing, I change the connection string to say "Data Source=testserver", but when users start the test app it will fail and the log says:
********** http://d9k2cn1j/Golfbreaks.TheClubhouse/Test/Golfbreaks.TheClubhouse_1_0_0_6/Golfbreaks.TheClubhouse.exe.config did not succeed. **********
But if I had left the connection string as "Data Source=(local)", which is where my Dev DB is, it works fine.
Also, if I change the .config file from "(local)" to "testserver" after a publish in the source directory , the database still points to (local)!!!
Any ideas how I could somehow tell the publisher to use a different .config file depending on where I'm deploying to
Many thanks for your time if anybody could help us.
Sean
- 12
- 13
- 14
- Windows Forms General Getting a form to appear only once
Hi All,
I have a windows 'Master frame' in which a number of forms can be instantiated (upon the selection of a menu item, or pressing a button in the master toolbar. All of these can be moved around within the boundaries specified in the master frame.
However, I don't want the user to be able to instantiate two instances of the same form in the frame! (E.g. One form is for "Student Details". If they press the student details button once, the form will appear. If they press it again, another form will appear.) Is there an easy way to do this (say in the properties of the form object) Also, if the form already exists, I would like it to set focus to the existing form.
Thanks heaps
Chris (Moderator: Thread moved to Windows Forms General for better responses)
- 15
- Windows Forms Data Controls and Databinding ErrorProvider time-delays
Several time-delay properties are exposed for the ToolTip component - AutoPopDelay, InitialDelay, ReshowDelay. These properties are not members of the ErrorProvider class. It seems as though they might be available somehow because the ErrorProvider displays what look like ToolTips, but I can't find the technique. Is there a way
Thanks, Gus
|
|
|