I have an application where I am using a DataGridView control to display DataTables stored in a DataSet. What I need to do is be able to prevent a user from adding a new if there is already a certain number of rows in the table. In addition, when the user deletes a row I need to be able to see the contents of that row and modify other rows in the DataTable appropriately.
From what I understand of the DataGridView controls interaction with its bound DataSet, it uses the a CurrencyManager to make changes to the table. I have tried to derive a class from CurrencyManger and create overloaded AddNew and RemoveAt methods, but I am not able to get the code to complie.
For Example:
public class NewCurrencyMana ger : CurrencyManager
{
public NewCurrencyMana ger(){
}
public override void AddNew()
{
if (this.Count > 15)
{
MessageBox.Show ("Out of Bounds");
}
else
base.AddNew();
}
}
Causes the error: error CS0143: The type 'System.Windows .Forms.Currency Manager' has no constructors defined
If the CurrencyManger is the right place to be looking, how should this be modified? If not, what approach should I be using?
Thanks
1 2063
I have an application where I am using a DataGridView control to display DataTables stored in a DataSet. What I need to do is be able to prevent a user from adding a new if there is already a certain number of rows in the table. In addition, when the user deletes a row I need to be able to see the contents of that row and modify other rows in the DataTable appropriately.
From what I understand of the DataGridView controls interaction with its bound DataSet, it uses the a CurrencyManager to make changes to the table. I have tried to derive a class from CurrencyManger and create overloaded AddNew and RemoveAt methods, but I am not able to get the code to complie.
For Example:
public class NewCurrencyMana ger : CurrencyManager
{
public NewCurrencyMana ger(){
}
public override void AddNew()
{
if (this.Count > 15)
{
MessageBox.Show ("Out of Bounds");
}
else
base.AddNew();
}
}
Causes the error: error CS0143: The type 'System.Windows .Forms.Currency Manager' has no constructors defined
If the CurrencyManger is the right place to be looking, how should this be modified? If not, what approach should I be using?
Thanks
I doubt if you need to write your own CurrencyManager here. I think you only need to intercept the event called when you click the save button and do the validations at that point.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jan van Veldhuizen |
last post by:
I have an application which is running fine with MS SqlServer, but it should
be working with Oracle as weel.
At a lot of places we rely upon the ADO Recordset to return incremented
identity columns.
Oralce however returns null or zero.
How can this be fixed easily?
Dim mConn As New ADODB.Connection
Dim rs As New ADODB.Recordset
|
by: Tim Marshall |
last post by:
ODBC situation, Access 97, here is the code and I've marked where
Access coughs up. The Access error message is 3027, can't update,
database is read only. The Oracle table in question has a primary key
defined as TEST_PK which is, of course, also an index:
Private Sub btnSave_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf1 As DAO.QueryDef
|
by: Kris Bethea via DotNetMonster.com |
last post by:
Greetings,
I have a VB.NET program that I am trying to convert to C# (my office
decided that we are going to use C# from now on).
I've only been working with C# for about a month now, so this has been
quite the learning experience for me.
The following code is from my VB.NET program and it selects the Call Number
from my datagrid and then uses that information to populate another form.
|
by: Mike Cooper |
last post by:
I have been staring at the above error for over a week now! I have a
an inherited data class looking like thus:
Public Class DataGridBoolColumnInherit
Inherits System.Windows.Forms.DataGridBoolColumn
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal
bounds As Rectangle, ByVal As CurrencyManager, ByVal rowNum
As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal
alignToRight As Boolean)
|
by: Jeremy |
last post by:
I have a dataset containing 2 tables. A is the master table, B is a lookup
table. There is a combobox bound to B, which updates a value in a FK field
in A.
my currencymanager is created thus:
cmB= CType(frm.BindingContext(DsClient1.Tables("B")), CurrencyManager)
The cbx has these settings:
cbx.valuemember=b.primarykey
cbx.displaymember=b.name
| |
by: NetRacer |
last post by:
hi,
i have a form with a read-only datagrid and some other controls. the
controls are bound to the same DataView as the datagrid.
i want the user to select a row in the grid and then he can edit the data in
the controls.
i use
currencymanager.position = datagrid.currentrowindex
and for existing rows it works.
|
by: Rich |
last post by:
Hello,
Following an example at
http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker)
on binding a dataRelation to a Datagridview for sqlClient, I was able to
view rows in datagridview2 that corresponded to a selected row in
datagridview1. Great article/example.
|
by: hartley_aaron |
last post by:
Hi,
CurrencyManger has a method called AddNew which well create a new
record in the data that it is bound to (ie a new datarow in a table).
The new record has null values for all of its elements. What I would
like to have is the ability to add a new record using the current
values of the TextBox fields that have been bound to the datasource.
I have tried various solutions to have the code edit the record using
the current values...
|
by: polocar |
last post by:
Hi,
I have noticed a strange behaviour of CurrencyManager objects in C# (I
use Visual Studio 2005 Professional Edition).
Suppose that you have a SQL Server database with 2 tables called
"Cities" and "Persons", and that:
"Cities" has 2 fields called "IDCity" and "NameCity"
"Persons" has 3 fields called "IDPerson", "NamePerson" and
"IDCityAddress"
with "IDCity" and "IDCityAddress" fields relationed with the
classical father-child relation...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |