在DataGridView中设置默认值. [英] Set Default value in DataGridView.

查看:201
本文介绍了在DataGridView中设置默认值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我想在datagridview字段中设置默认值.

我没有用于读取或写入的任何代码,因为我有用于此datagridview的数据源连接.
我想运行一个sql来找到备用键,然后将值放在第二列中.
第二列visible = false ........


谢谢和问候.......

Hi to all.

I want to set default value in a datagridview field.

I dont have any code for read or write because i have a data source connection for this datagridview.
I want to run an sql to find the alternate key and put the value in the second column.
The second column the visible=false........


Thanks and regards.......

推荐答案

您的问题尚不完全清楚,但据我了解,您可能需要处理DataGridView.DefaultValuesNeeded [
Your question is not entirely clear but from what I can understand you may need to handle the DataGridView.DefaultValuesNeeded[^] event.


您的问题不是很清楚,但我认为您希望将Grid与从数据库获得的默认值绑定.
为此,您必须将数据源分配给DataGrid的bind属性.点击此链接以获取更多参考.
http://social.msdn.microsoft.com/论坛/en-US/winformsdatacontrols/thread/2b5cab23-5894-450b-972d-57b4334bea2a [
Your question is not that much clear but what I think is you want to Bind the Grid with the default values you get from database.
For that you have to assign your Data source to the DataGrid''s bind property. Follow this link for more reference.
http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/2b5cab23-5894-450b-972d-57b4334bea2a[^]

If you describe your question clearly the more you will drove towards solution. So be precise in description of your question.


首先,甘道夫(Gandalf)感谢您的宝贵时间.

因此,我有一个datagridview,它从访问的一个表中填充.
在我的datagridview中,我想显示7个字段. (我总共有9个字段)
在其中一个中,我要放置一个在保存之前计算的数字,另一个中我要放置系统日期和时间..

我保存的datagridview包含此代码
First of all Gandalf Thanks for your time.

So I have a datagridview that fill from one table from access.
In my datagridview i want to show 7 of me fields. (Totaly i have 9 fields)
In one of them i want to put a number that calculate before save and the other put the system date and time..

My datagridview for save has this code
Private Sub Movement_roller_DBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Movement_roller_DBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.Movement_roller_DBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.RollerDataSet)
End Sub



保存前我该怎么做才能填补我的2个隐藏字段??????

我希望更具体
谢谢和问候



What can i do to fill my 2 hidden fields before save??????

I hope to be more specific
Thanks and regards


这篇关于在DataGridView中设置默认值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆