I am clicking on the first cell in the next available row when I receive the error. When I selected the datatable to use for the grid it created a binding source. When I try to execute the RemoveAt with the binding source it errors out. Is there an easier way to do this?
kruegersck
Posts
-
Datagridview Error -
Datagridview ErrorI created a DataSource with a DataTable in it and added it through the wizzard when I added the Grid to my form. When a user enters 0 in the first cell I want to remove that row from the grid. I hope this helps Thanks!
-
Datagridview ErrorI don't understand please forgive me. I am new to Datagridview grids. After I remove the row from datatable what do I need to do next? I read through your articles, but I am confused??
-
Datagridview ErrorIs there an article or code sample showing rebinding? Here is my code: //Are there rows that need to be deleted? for (int x = 0; x < dsInvoice.Tables["Invoice"].Rows.Count; x++) { if (dsInvoice.Tables["Invoice"].Rows[x]["QTYORD"].ToString() == "0") { dsInvoice.Tables["Invoice"].Rows[x].Delete(); dataGridView1.Refresh(); } } Thanks for all your help
-
Datagridview ErrorI have a datagridview bound to a datatable. When I remove a row from the datatable the grid reflects the change, but when I attempted to add a row back in I get an error System Index out of Range? I have tried datagridview1.Refresh() with no luck. What am I missing? Thanks
-
Datagridview row delete questionI have a datagridview that is bound to a datatable in my application. I want to delete a row based on a value in a column. I have the code to remove the row from the datatable and it removes it from the datagridview on the refresh for rows 1-x. Here is my issue when I change the value on the first row(0) to delete it, I can't? Any help would be appreciated.
-
DatagridView Multiple ComboBox issueI have attached the following code. I have a datagridview with three comboboxes on it. When I select an item from the first combobox it functions as intended. The problem I am having is that when I click on the second or third combobox it executes the item_SelectedIndexChanged event as shown below. I know I am missing something stupid! Any help is appreciated! Thanks! private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { int columnindex = dataGridView1.CurrentCell.ColumnIndex; ComboBox combo; if (dataGridView1.CurrentCell.ColumnIndex == 3) { combo = e.Control as ComboBox; if (combo == null) return; combo.SelectedIndexChanged -= item_SelectedIndexChanged; combo.SelectedIndexChanged += item_SelectedIndexChanged; } } void item_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cmbBox = (ComboBox)sender; int x = Convert.ToInt32(cmbBox.SelectedIndex.ToString()); int y = dataGridView1.CurrentRow.Index; dataGridView1.Rows[y].Cells[4].Value = dsInvoice.Parts.Rows[x]["DESC"].ToString(); dataGridView1.Rows[y].Cells[5].Value = Convert.ToDecimal(dsInvoice.Parts.Rows[x]["Price"].ToString()); }
-
Need HelpI have an ASP.Net Page using C# and I am getting this error: No value given for one or more required parameters. Here is my code. Any help would be appreciated. <asp:HiddenField ID="hidfld1" runat="server" /> <br /> <asp:HiddenField ID="hidfld2" runat="server" /> <br /> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/mail.mdb" DeleteCommand="DELETE FROM Email WHERE ((Email = ?) OR (Email IS NULL AND ? IS NULL))" InsertCommand="INSERT INTO Email (Email) VALUES (?)" SelectCommand="SELECT Email FROM Email WHERE (Email = ?)"> <SelectParameters> <asp:Parameter Name="Email" Type="String" /> </SelectParameters> <DeleteParameters> <asp:Parameter Name="Email" Type="String" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="Email" Type="String" /> </InsertParameters> </asp:AccessDataSource> Code: protected void Page_Load(object sender, EventArgs e) { hidfld1.Value = Request.QueryString["Email"].ToString(); hidfld2.Value = Request.QueryString["ACT"].ToString(); if (hidfld2.Value == "S") AddRec(); else DelRec(); } protected void AddRec() { try { AccessDataSource1.InsertParameters["Email"].DefaultValue = hidfld1.Value; AccessDataSource1.Insert(); } catch (Exception ex) { lblError.Text = ex.Message; } } protected void DelRec() { try { AccessDataSource1.DeleteParameters["Email"].DefaultValue = hidfld1.Value.ToString(); AccessDataSource1.Delete(); } catch (Exception ex) { lblError.Text = ex.Message; } } }
-
Suppress Date on MS ReportI have a date fields on my MS Report. If the date is blank or null, I do I suppress the date so It doesn't show 01/01/0001 on my report. Thanks!
-
Newbie QuestionI have developed a windows app that will run on a local network. I have the app set so users can run the app from the server. What do I need to do so the user doesn't get the message: "The publisher could not be verified. Are you sure you want to run this software" Thanks in advance! sk
-
Microsoft Reporting (subreports)I am new to C# and VS2008. I am trying to create a report with a subreport. I have searched Google not to find a good example of how to create a report with a subreport. Does anybody have a good link for showing an example of this? Thanks! sk
-
Newbie DatagridView QuestionI am working on a Invoice Application in which a user can enter in the invoice line items by selecting the item number from a combobox within a DataGridView. I am looking for some sample code to do the following: 1. load a combox within a datagridview from a table 2. load other fields (item descr, item price from combobox table) As always, thanks for the advice.
-
Split Name FieldAll - I am looking for an easy solution to split a name field from another DB. I am converting data from on DB to another. In the source DB the name field is one field that is free form. Here are some examples of names: John Smith John E Smith DR John E Smith DR John Smith In my db the name field is first and last name (separate fields). Any suggestions? As always thanks for your help! sk
-
Need HelpAll - I have an application that was written in VB 6 back in the mid-90's. I want to rewrite this app in ASP.Net, but I cannot open the project files with VS 2008. When I try to convert the files it gives me a error about an .ocx file missing that I can see in the directory? If any body could open this project and send me the forms and code that would be great or if you could point in a direction to get VB 6 since it is no longer support by MS. Thanks! sk
-
Newbie HelpThanks for the Help! sk
-
Newbie HelpAll - I am trying to create a simple app that will capture emails and when my users try to remove their email from the db they get an error. Here is my ASP code: <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/mail.mdb" DeleteCommand="DELETE FROM [Email] WHERE (([Email] = ?) OR ([Email] IS NULL AND ? IS NULL))" InsertCommand="INSERT INTO [Email] ([Email]) VALUES (?)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [Email] FROM [Email]"> <DeleteParameters> <asp:ControlParameter ControlID="txtEmail" Name="original_Email" PropertyName="Text" Type="String" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="Email" Type="String" /> </InsertParameters> </asp:AccessDataSource> Here is the code below: protected void btnSubscribe_Click(object sender, EventArgs e) { AccessDataSource1.InsertParameters["Email"].DefaultValue = txtEmail.Text; try { AccessDataSource1.Insert(); txtEmail.Text = ""; lblError.Text = "Email sucessfully added"; } catch { lblError.Text = "Email already exists"; } } protected void btnUnSub_Click(object sender, EventArgs e) { AccessDataSource1.DeleteParameters["Email"].DefaultValue = txtEmail.Text; try { AccessDataSource1.Delete(); txtEmail.Text = ""; lblError.Text = "Email has been removed"; } catch { lblError.Text = "Email doesn't exist"; } } Thanks for all your help
-
Newsletter AppI am looking for a simple ASP newsletter app so our web users can sign up to review newsletters and other marketing material from us. If any body has any sample code of this and can point me in the right direction I would appreciate it. Thanks sk
-
Search Form Question (Newbie)I am looking for a simple search form that a user enters in their search criteria then the script searches a DB for results and displays them on a new page. Any links to pages or help will be greatly appreciated. sk
-
Newbie QuestionI have a form that has many text boxes on it. When the user selects a record to work with I load all the text boxes with the approiate data. I want to be able to determine if the user changed any of the content in any of the text boxes? I have looked at the text change event, but won't this event fire when I load the text boxes from the db? If any body has any suggestions or sample code for doing this it would be appreciated! Thanks! sk
-
Newbie QuestionI have written a Windows Form Application that updates a MS Access DB. I want to be able to install this application on a server and then allow my clients to create shortcuts to the .exe. When I try to do this I get an error: System.Security.Permissions.FileIOPermissions, mscorlib? How do I fix this. Thanks!