The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I tried doing this in VB but it won't work!
dataGrid1.DataSource = dataSet.Tables["customers"].DefaultView;
// do not allow an appendrow...
((DataView)dataGrid1.DataSource).AllowNew = false;
MY CODE:
datagrid1.datasource = dataset.tables ("customer").defaultview
CType(datagrid1.datasource, dataview).allowNew = false
I cannot change the type of the datasource to a dataview..that's the error!!
CBClay Burch Syncfusion Team June 1, 2002 08:07 AM UTC
Check your code because I think this should work OK. In the C# code, it was "customers" and in the VB code, it was "customer". Did you mean to have it like this?
This code worked for me using the orders table from the northwind database.
Dim conStr As String
conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:orthwind.mdb"
Dim sqlStr As String
sqlStr = "SELECT * FROM Employees"
' Create connection object
Dim conn As OleDbConnection
conn = New OleDbConnection(conStr)
' Create data adapter object
Dim da As OleDbDataAdapter
da = New OleDbDataAdapter(sqlStr, conn)
' Create a dataset object and fill with data using data adapters Fill method
Dim ds As DataSet
ds = New DataSet()
da.Fill(ds, "Employees")
dataGrid1.DataSource = ds.Tables("Employees").DefaultView
dim dv as DataView = dataGrid1.DataSource
CType(dataGrid1.DataSource, DataView).AllowNew = False
JOjollyJune 1, 2002 08:34 AM UTC
Thanks yet again! I'll try that. You have added a dim dv as DataView = dataGrid1.DataSource
which i did not do. thanks!! :)
> Check your code because I think this should work OK. In the C# code, it was "customers" and in the VB code, it was "customer". Did you mean to have it like this?
>
> This code worked for me using the orders table from the northwind database.
>
>
> Dim conStr As String
> conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:orthwind.mdb"
> Dim sqlStr As String
> sqlStr = "SELECT * FROM Employees"
> ' Create connection object
> Dim conn As OleDbConnection
> conn = New OleDbConnection(conStr)
> ' Create data adapter object
> Dim da As OleDbDataAdapter
> da = New OleDbDataAdapter(sqlStr, conn)
> ' Create a dataset object and fill with data using data adapters Fill method
> Dim ds As DataSet
> ds = New DataSet()
> da.Fill(ds, "Employees")
> dataGrid1.DataSource = ds.Tables("Employees").DefaultView
> dim dv as DataView = dataGrid1.DataSource
> CType(dataGrid1.DataSource, DataView).AllowNew = False
>