Solved

VB.Net DataGrid - Row Add coding questions

Posted on 2007-03-29
1
336 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
1 Comment
 
LVL 34

Accepted Solution

by:
Sancler earned 250 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now