?
Solved

VB.Net DataGrid - Row Add coding questions

Posted on 2007-03-29
1
Medium Priority
?
348 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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