?
Solved

VB.Net DataGrid - Row Add coding questions

Posted on 2007-03-29
1
Medium Priority
?
350 Views
Last Modified: 2010-04-23
Hello,
 
I'm looking for a way to smarten up my DataGrid in VB.Net 2005.
 
On the initial load of data into my DataGrid, I set columns 0 and 1 to ReadOnly, but for a RowEnter event I plan to change the ReadOnlly of Column(0) to False and then back to True again on RowLeaving Event.

This DataGrid has a DataSource of a DataTable in VB.  

What I'd like to do is default zero's in all DataGrid columns from index 2-14 so they don't leave these as null values in a DataTable\Column that does not allow null.

Can I set DataGrid cells to a value or do I need to create this row in my DataTable source and then refresh my DataGrid?

Thanks!
JMO9966
0
Comment
Question by:JMO9966
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 34

Accepted Solution

by:
Sancler earned 1000 total points
ID: 18817854
You can set this in your datatable.  Try this

        For i As Integer = 2 To 14
            <myDataTable>.Columns(i).DefaultValue = 0
        Next

Then, when a user goes into edit the new row in the datagrid, all the columns from 2 to 14 will have 0s in them.

Roger
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question