- [DEVEXPRESS] Hỗ trợ tìm kiếm highlight không dấu và không khoảng cách trên Gridview Filter
- [C#] Chia sẻ source code phần mềm Image Downloader tải hàng loạt hình ảnh từ danh sách link url
- [C#] Chụp hình và quay video từ camera trên winform
- [C#] Chia sẽ full source code tách file Pdf thành nhiều file với các tùy chọn
- Giới thiệu về Stock Tracker Widget - Công cụ theo dõi cổ phiếu và cảnh báo giá tăng giảm bằng C# và WPF
- [VB.NET] Chia sẻ công cụ nhập số tiền tự động định dạng tiền tệ Việt Nam
- [VB.NET] Hướng dẫn fill dữ liệu từ winform vào Microsoft word
- [VB.NET] Hướng dẫn chọn nhiều dòng trên Datagridview
- Hướng Dẫn Đăng Nhập Nhiều Tài Khoản Zalo Trên Máy Tính Cực Kỳ Đơn Giản
- [C#] Chia sẻ source code phần mềm đếm số trang tập tin file PDF
- [C#] Cách Sử Dụng DeviceId trong C# Để Tạo Khóa Cho Ứng Dụng
- [SQLSERVER] Loại bỏ Restricted User trên database MSSQL
- [C#] Hướng dẫn tạo mã QRcode Style trên winform
- [C#] Hướng dẫn sử dụng temp mail service api trên winform
- [C#] Hướng dẫn tạo mã thanh toán VietQR Pay không sử dụng API trên winform
- [C#] Hướng Dẫn Tạo Windows Service Đơn Giản Bằng Topshelf
- [C#] Chia sẻ source code đọc dữ liệu từ Google Sheet trên winform
- [C#] Chia sẻ source code tạo mã QR MOMO đa năng Winform
- [C#] Chia sẻ source code phần mềm lên lịch tự động chạy ứng dụng Scheduler Task Winform
- [C#] Hướng dẫn download file từ Minio Server Winform
[C#] Hướng dẫn convert Dataset to File Json trong lập trình Csharp
Bài viết hôm nay, mình sẽ hướng dẫn các bạn cách chuyển đổi dữ liệu từ DataSet sang File Json C#.
Để convert Dataset => file Json, mình sử dụng thư viện Newtonsoft.json.
Các bạn có thể download và cài đặt nó từ Nuget.
Giao diện ứng dụng:

Source Code C#:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DataSet2Json
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            DataSet dataSet = new DataSet("dataSet");
            dataSet.Namespace = "NetFrameWork";
            DataTable table = new DataTable();
            DataColumn idColumn = new DataColumn("id", typeof(int));
            idColumn.AutoIncrement = true;
            DataColumn itemColumn = new DataColumn("item");
            table.Columns.Add(idColumn);
            table.Columns.Add(itemColumn);
            dataSet.Tables.Add(table);
            for (int i = 0; i < 1000; i++)
            {
                DataRow newRow = table.NewRow();
                newRow["item"] = "item " + i;
                table.Rows.Add(newRow);
            }
            dataSet.AcceptChanges();
            string json = JsonConvert.SerializeObject(dataSet, Formatting.Indented);
            richTextBox1.Text = json;
        }
    }
}HAVE FUN :)

![[C#] Hướng dẫn convert Dataset to File Json trong lập trình Csharp](https://laptrinhvb.net/uploads/users/9a8cb514e4428e85fb4ca07588e9103f.png)

![[C#] LINQ trong CSharp - Phần một](https://laptrinhvb.net/uploads/source/image_baiviet/833b1af041117b932108bd2ed9e3fc96.jpg)
![[C#] Hướng dẫn tạo Dynamic Control Runtime để hiển thị danh bạ](https://laptrinhvb.net/uploads/source/csharp/dynamic_control_csharp_thumb.jpg)
![[C#] Hướng dẫn sử dụng Telnet để download và upload file](https://laptrinhvb.net/uploads/source/image_baiviet/2c8a6e07cd0678e5c8f06ab5d4c531ec.jpg)
![[C#] Chia sẽ class INIHelper dùng để ghi và đọc file config INI](https://laptrinhvb.net/uploads/source/web/config_thumb_ini.png)
![[C#] Hướng dẫn tạo Windows Services đơn giản Winform](https://laptrinhvb.net/uploads/source/vbnet/windows_services_thumb.jpg)
![[C#] Hướng dẫn chạy ứng dụng EXE từ bộ nhớ Embedded Resource](https://laptrinhvb.net/uploads/source/vbnet/embbed_resource_csharp_thumb.jpg)

![[C#] Hướng dẫn lưu trữ mật khẩu ở Credential Manage Windows](https://laptrinhvb.net/uploads/source/new_image_baiviet/credentials_manager_windows.png)
![[C#] Hook Right context menu windows (ex: Pin and Unpin Taskbar)](https://laptrinhvb.net/uploads/source/csharp/pin_unpin_taskbar_thumb.jpg)
![[C#] Hướng dẫn tích hợp ứng dụng Notepad vào Winform](https://laptrinhvb.net/uploads/source/image_baiviet/364e3d7fe76255197cae5b07b9e1fff3.png)
![[C#] Hướng dẫn viết ứng dụng show and hide icon desktop windows](https://laptrinhvb.net/uploads/source/csharp/hide_show_icon_desktop_thumb.jpg)
![[C#] Tìm kiếm tập tin file nhanh chóng trên Winform sử dụng thư viện FastSearchLibrary](https://laptrinhvb.net/uploads/source/vbnet/search_file_csharp_thumb.png)
![[C#] Hướng dẫn lấy thời gian thực server time trên winform](https://laptrinhvb.net/uploads/source/vbnet/server_time_thumb.png)
![[C#] Gởi tin nhắn Telegram sử dụng TLSharp Lib Winform](https://laptrinhvb.net/uploads/source/vbnet/telegram_bot_csharp.jpg)
![[C#] Hướng dẫn thiết kế Label Vertical Align Text trong Winform](https://laptrinhvb.net/uploads/source/csharp/vertical_align_text_thumb.png)
![[C#] Giới thiệu và sử dụng thư viện AutoMapper](https://laptrinhvb.net/uploads/source/new_image_baiviet/auto_mapper_thumb.png)
![[C#] Đăng nhập login phần mềm bằng tài khoản Domain Controller](https://laptrinhvb.net/uploads/source/new_image_baiviet/login_account_domain.png)
![[C#] Hướng dẫn thực thi tập tin python trong winform](https://laptrinhvb.net/uploads/source/vbnet/maxresdefault.jpg)
![[C#]  Quản lý dịch vụ Windows Services trên Csharp Winform](https://laptrinhvb.net/uploads/source/new_image_baiviet/windows_services.jpg)
![[C#] Hướng dẫn tạo tab ứng dụng giống Chrome sử dụng thư viện EasyTabs](https://laptrinhvb.net/uploads/source/csharp/tab_google_thumb.png)
![[C#] Chụp ảnh màn hình sử dụng Spy++ Win32 Winform](https://laptrinhvb.net/uploads/source/csharp/spy_capture_csharp.gif)
![[C#] Hướng dẫn tạo hiệu ứng ẩn hiện ctrol trên Winform sử dụng Bunifu Animation Framework](https://laptrinhvb.net/uploads/source/csharp/animation_csharp_thumb.gif)

![[C#] Giải pháp thay thế Web Browser Control mặc định bằng Awesomium của bộ Visual Studio](https://laptrinhvb.net/uploads/source/image_baiviet/0ddd54d36f9c30418c8465205ee441d2.png)
![[C#] Hướng dẫn custom Radio Button trên Winform](https://laptrinhvb.net/uploads/source/vbnet/custom_radio_button.gif)
