| menu strip and mdi in vb 2005 |
|
 |
Index ‹ Windows Forms ‹ Windows Forms Data Controls and Databinding
|
- Previous
- 1
- 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);
- 2
- 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
- 3
- Windows Forms General Control textbox, promtly
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.
- 4
- 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
- 5
- 6
- 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>
- 7
- 8
- 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.
- 9
- 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
- 10
- 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
- 11
- 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)
- 12
- 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
- 13
- 14
- 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
- 15
- 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.
|
| Author |
Message |
Binu Jeesman

|
Posted: Windows Forms Data Controls and Databinding, menu strip and mdi in vb 2005 |
Top |
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
Windows Forms6
|
| |
|
| |
 |
Binu Jeesman

|
Posted: Windows Forms Data Controls and Databinding, menu strip and mdi in vb 2005 |
Top |
i got the answer.
i had to write the following code.
Form7.MdiParent = Me
Form7.Show()
|
| |
|
| |
 |
| |
 |
Index ‹ Windows Forms ‹ Windows Forms Data Controls and Databinding |
- Next
- 1
- 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()); } }
- 2
- 3
- 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
- 4
- 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
- 5
- 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.
- 6
- 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.
- 7
- 8
- 9
- 10
- 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...
- 11
- 12
- 13
- 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..
- 14
- 15
|
|
|