473,511 Members | 17,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with VB.NET Datagrid

Hi,

I have been working with datagrids a lot in the past two weeks and I
am running across a lot of problems. Maybe there is no way around
these problems but I hope there are and someone out there can advise
me on how to do it.

1. The biggest problem I am finding is that the datagrid does not
update the datagrid.datasource very well. When a new row is created
in the datagrid it may or may not be created in the datasource as
well. When the rows are sorted in the datagrid, the datasource has no
idea what the new structure is. These inconsistencies are causing me
a lot of problems in the code I am trying to run behind the scenes.

2. I am also attempting to use combo box style columns in my datagrid
and this is just a mess. My code works great unless users try to use
certain features the datagrid object makes possible - such as the
escape key to go back to previously entered information - even when
the datagrid remembers this old information, I can't get my combo
boxes to remember and retain this value when the user clicks away.
Has anyone successfully used combo box columns in their datagrids and
eliminated these kinds of errors??

Any advice would be greatly appreciated!! Thanks!!

Joy
Nov 21 '05 #1
3 2611
jim
Hi Joy,

1a. in order to propagate the new row to the datagrid you need to ensure
that the DataGrid.EndEdit() call is made. Typically you can ensure this
happens by moving either up a row or down a row while the grid has the
focus, or clicking on another row in the grid. In this scenario, the grid
calls the EndEdit on the particular row for you... the problem with this is
that if you only have a single row, you can't move up or down, and if you
just click off of the grid to say click a button to update back to the
database, the EndEdit doesn't seem to get called.

How I hande this is by making sure to call the EndEdit method of the
datagrid and the EndEdit method of the datarow that was last being edited.

1b. to get the current row that is selected in the grid you use the binding
context and the currencymanager to get it. ex.

ctype(myDatagrid.BindingContext(myGridsDataSource) .Current, DataRowView).Row
(forgive and misspells or mistypes, it's late!)

this will give you the currently selected row in the grid regardless of the
grids current sort.

2. I've never implemented a custom grid column style, but i'm not sure which
code you're using in particular. i know that there is a good one on
Syncfusions Windows Forms Faq. I'm not sure of the url offhand, but if you
just do a search for "syncfusion windows forms faq" in this group you should
come up with a million hits...

hope this helps.

good luck,

jim
<si***********@yahoo.com> wrote in message
news:1d**************************@posting.google.c om...
Hi,

I have been working with datagrids a lot in the past two weeks and I
am running across a lot of problems. Maybe there is no way around
these problems but I hope there are and someone out there can advise
me on how to do it.

1. The biggest problem I am finding is that the datagrid does not
update the datagrid.datasource very well. When a new row is created
in the datagrid it may or may not be created in the datasource as
well. When the rows are sorted in the datagrid, the datasource has no
idea what the new structure is. These inconsistencies are causing me
a lot of problems in the code I am trying to run behind the scenes.

2. I am also attempting to use combo box style columns in my datagrid
and this is just a mess. My code works great unless users try to use
certain features the datagrid object makes possible - such as the
escape key to go back to previously entered information - even when
the datagrid remembers this old information, I can't get my combo
boxes to remember and retain this value when the user clicks away.
Has anyone successfully used combo box columns in their datagrids and
eliminated these kinds of errors??

Any advice would be greatly appreciated!! Thanks!!

Joy

Nov 21 '05 #2
Joy,

To overcome your problem with the datagridupdate set somewhere before the
update this one

BindingContext(TheDatagridDatasource).EndCurrentEd it()

For a combobox in a datagrid I made a sample using the Syncfusion simple
sample which I updated by the way to let it go with early binding.

http://www.google.com/gr************...TNGP11.phx.gbl

I hope this helps?

Cor

Nov 21 '05 #3

Thank you so much for all the help!! I was able to use many of your
suggestions to resolve most of my issues.

However, I am still encountering some inconsistencies with my combo box
datagrid columns and I am actually using the code you recommended - the
Syncfusion sample. I am still encountering the problems I mentioned
before in my first posting such as the escape key problem - has anyone
ever resolved this issue??

Joy
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1342
by: JP011 | last post by:
Hello I have hit a major road block when it comes to building my dynamic datagrid. To make a long story short I need a dynamic datagrid because my connection string could change and I need the...
2
3239
by: Tamlin | last post by:
Hi all, I'm getting a bug with the datagrid object. I've created one from scratch, bound it to a dataview with 2 int32 columns and formatted the output as currency. I've found that when you...
3
1863
by: Igor Mendizabal | last post by:
Hello, We're doing our own datagrid based on the System.windows.forms.datagrid control, and are having some problems with horizontal scrolling. In general, we construct our datagrid adding a...
3
4236
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
0
1041
by: THM5101 | last post by:
Hello I have two problems with my dataGrid. I created dataGrid with 4 columns. The first and the last one are LinkButton type, the second and third are Bound Column type. My problems are:...
0
1683
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
1
2256
by: Vili | last post by:
Hi all I am having problems with asp.net 1.1 and nested datagrid. I have a datagrid (dgDetail) nested inside a datagrid (dgMaster). How can I make all the rows editable in dgDetail? So that...
0
2569
by: Scott | last post by:
Hello all and thanks in advance for any help you may be able to offer me. I am quite new to asp.net and am trying to work with a datagrid but am having some problems with it. Here's the...
2
2160
by: ree321 | last post by:
I tried moving an ASP.net project form 1.1 to 2.0. But I am having problems with getting the OnItemDataBound function to run for a datagrid, in 2.0. It only gets called up if AutoGenerateColumns...
0
7242
marktang
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,...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
jinu1996
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...
0
7510
tracyyun
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...
0
5668
agi2029
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,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.