Closed criss02-cs closed 2 years ago
Can you please provide your code? It worked fine in my test. Which version of Krypton are you using? Which TFM? Which VisualStudio Version?
Here a Mini-Example: KryptonTest.zip
Greetings DarthVader :)
Hi,
List<User> users = JsonConvert.DeserializeObject<List<User>>(_json, settings);DataTable dt = users.ToDataTable();dgvList.DataSource = dt;dgvList.RowHeadersVisible = false;
This is my code. I'm using VisualStudio2019, and I think I'm using the last version of Krypton I have installed from your's github. I don't know how to let you know which TFM i'm using
I saw your example, you are using VB but I'm using C#
Hi,
Is users.ToDataTable()
a extension to a List-Class? I don't know this command/function on a List-Class-Object.
Is your Deserialization of the JSON-Object works fine? You got a List of User?
TFM = your Framework that you use. .NET 5.0, .NET 6.0, .NET-Framework 4.8.2?? I used a NuGet-Package for my example.
You can use a VB.NET to C# Converter like https://converter.telerik.com/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualBasic;
public class TestForm
{
public TestForm()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Bind DataTable to Grid
this.dgvTest.DataSource = this.GetDataTable();
}
private DataTable GetDataTable()
{
// Create DataTable
DataTable dtTest = new DataTable("Test");
// Add Columns
dtTest.Columns.AddRange(new DataColumn[] {
new DataColumn("colID", typeof(int)) { AllowDBNull = false, Caption = "ID" },
new DataColumn("colDesc", typeof(string)) { AllowDBNull = false, Caption = "Description" }
});
// Add Example-Rows
dtTest.Rows.Add(1, "First Row");
dtTest.Rows.Add(2, "Second Row");
dtTest.Rows.Add(3, "Thirth Row");
dtTest.Rows.Add(4, "Fourth Row");
// Return DataTable
return dtTest;
}
}
Hi, users.ToDataTable() is a extension method that I have created to parse a list to a DataTable. The parsing from json is working perfectly. I use net 5.0
public static DataTable ToDataTable
Hi, I replicated your case and everything works fine. Not sure what is your User class structure or how many rows of data you have but for a small simple example it worked just fine. It could be your User class has some weird property which is in conflict with gridview column property or something similar. In any case I don't see any problem here related to Krypton GridView.
I think this issue can be closed.
Hi @criss02-cs is it possible that the extension method gets stuck in a loop when handling large amounts of data, or a memory leak?
Hi @criss02-cs is it possible that the extension method gets stuck in a loop when handling large amounts of data, or a memory leak?
HI, I don't think it's that because I tested with only 2 rows
I tried to use a normal datagrid and I works fine
Hi @criss02-cs is it possible to provide a video? I've ran your example and it seems to work.
Hi @criss02-cs is it possible to provide a video? I've ran your example and it seems to work.
Sorry I can't send a video right now. I will send it as fast as I can
Hi, I have already tested and it's works fine, I don't know how but it works
Describe the bug When I try to populate a KryptonDataGridView with a DataTable that will freeze my form and I can't do anything