Warning: is_file(): File name is longer than the maximum allowed path length on this platform (260): C:\Domains\khonggianweb.com\basiap.com\data:image\png;base64,iVBORw0KGgoAAAANSUhEUgAABHoAAALYCAYAAAADy5WqAAAgAElEQVR4nOzde3xU9b3o\c9MJgn3ey6KJoZL0GAipQXLJUA0oaRa29oi125obW1LrfSc5xzZ+5GwTyE+e+M+z3NKVXYv2qIHkOipVkUjEuQSLvVS1ARSiQRMAM2FcJEQSDKz1vPHusyaayZhJjMJ3\dLnJl1+c0vM2utWeu7vr\fz6aqqooQQgghhBBCCCGE6PXs0a6AEEIIIYQQQgghhAgPCfQIIYQQQgghhBBC9BEO48nWrVtRVBVVUVBVFUVRUVXFnKaoKv0SEyksLCQpKSmadRZCCCGEEEIIIYQQfpiBHkVVWbxokTlDBS5cVRiWqCX9vPhiCZMmTWL7G29w7z33RCTYE0qwqX+\fsybN69L73+p4j5UVQXtP+3R6JrI8lxVwd7vFoZlPx32v00IIYQQQgghhBAi0sxAj6ooALgUBVRY97fzzBrdj9yb+pkLjxo1ijunTuX111\nRz\6UaeFP\bYYzz++OMhV8ZfsAlLV9FGsOmNN9\knm9+M+Rgj6qqDBm9QC9M0SI6KNpr1fOxufb1kOvbXV39XIQQQgghhBBCCCFCYfbRY81w2Xv6Cs8fvQTAt3dewIi2PP\885SWlnLp8uWQCr\55pu7VBlrsMnlUnC5XLhcLpz6P9CCTVOnTOH117d3oWDjf8GDPNr8LlW5W7r6uQghhBBCCCGEEEKEwt10S9EiHBfaXPy3Pc0MS7STk5TAqzf1A1Tuv\97qIAjLo6nng6tadOQIUO6VBmP5lQ+ERd3sAnAkZAQerlAaEEepSfiPJ1+Lq2trbz88su0traa06ZMmcJXvvKVSFdNCCGEEEI in C:\Domains\khonggianweb.com\basiap.com\libraries\src\Filesystem\File.php on line 649
Lập trình C#

Lập trình C#

cấu hình hiển thị cột cho DataGridView

Trong bài viết này, chúng ta sẽ tìm hiểu về cách làm việc với MongoDB trong ASP.NET Core. Chúng tôi sẽ xây dựng một Dự án WebAPI có thể quản lý dữ liệu khách hàng. Trong quá trình này, chúng tôi sẽ đề cập đến các khái niệm khác nhau bao gồm Giới thiệu về Cơ sở dữ liệu NoSQL, MongoDB là gì, Cài đặt MongoDB cục bộ và trên đám mây, Tích hợp với ASP.NET Core và hơn thế nữa.

Cách Export/Import project template, item template

Hãy tưởng tượng nhé, bạn thiết kế xong các form rất đẹp, hạy một Project hoàn hảo. Bạn muốn tất cả các project sau này, các form sau này bạn có thể sử dụng lại các form đẹp đẽ bạn đã làm hay Clone nguyên Project bạn đã làm chỉ với 1 click. Với Visual Studio điều đó thật đơn giản.

Trong lập trình C#, Visual studio đã cung cấp cho chúng ta công cụ Import/Export template. Bạn có thể Export một Form bất ký thành template và sử dụng lại. Bạn có thể Export bất kỳ Project nào sau đó sử dụng lại như một Project mới hòan toàn.

Trước tiên bạn cần thiết kế toàn bộ các form tiêu chuẩn để re-use va bắt đầu thực hiện các bước sau để export template cho các Project hoặc form mẫu. Lưu ý những form mẫu có sử dụng resource (image) thì nên dùng Local Resource.

B1. File\Export template

B2. Choose template type (Tạo mẫu cho cả Project hoặc 1 form mẫu trong Project)

B3. Input template option (Name, des, Icon, Output Lotion, Auto Import to VS, Open destination file)

B4. Nhấn Finish để Export.

Các template này tự động lưu vào thư mục template. Khi tạo mới Form hoặc Project bạn chỉ cần chọn đúng template và nhập tên mới, bạn sẽ được 1 Project, 1 Form mới giống hệt template của bạn.

Basiap tms wms web 276

Basiap tms wms web 277

Chỉ có vậy thôi nhé, quá dễ bạn nhỉ. Các khó khăn bạn vui lòng để lại tin nhắn phía dưới nhé.

Tham khảo thêm: https://msdn.microsoft.com/en-us/library/tsyyf0yh.aspx

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The steps in the first procedure of this topic show you how to create an item template by using the Export Template wizard. If your template will consist of multiple files, see How to: Create Multi-file Item Templates.

The wizard does a lot of work for you to create the basic template, but in many cases you will need to manually modify the .vstemplate file after you have exported the template. For example, if you want the item to appear in the Add New Item dialog for a Windows 8.x Store app project, you’ll have to perform a few extra steps. The second procedure in this topic helps you accomplish that task.

To specify that your template should only appear for only certain project sub-types, such as Office, Database or Web, see this section.

In some cases you may want or need to create an item template manually from scratch. The third procedure shows how to do that.

See the Visual Studio Template Schema Reference for information about the elements that can be used in the .vstemplate file.

To add a custom project item template to the Add New Item dialog box

  1. Create or open a project in Visual Studio.
  2. Add an item to the project and modify it if you want to.
  3. Modify the code file to indicate where parameter replacement should take place. For more information, see How to: Substitute Parameters in a Template.
  4. On the File menu, click Export Template.
  5. Click Item Template, select the project that contains the item, and click Next.
  6. Select the item for which you want to create a template, and click Next.
  7. Select the assembly references to include in the template, and click Next.
  8. Type the icon file name, preview image, template name, and template description, and click Finish.

The files for the template are added to a .zip file and copied whatever directory you specify in the dialog. The default location is ..\Users\<username>\Documents\Visual Studio <Version>\My Exported Templates\ folder.

 Warning

In earlier versions of Visual Studio, the default location is ..\Users\<username>\Documents\Visual Studio <Version>\Templates\ItemTemplates.

To enable the item template to be used in a store project

  1. Follow the steps in the procedure above to export an item template.
  2. Extract the .vstemplate file from the .zip file that was copied to the ..\Users\username\Documents\Visual Studio Version\Templates\ItemTemplates\ (or My Exported Templates) folder.
  3. Open the .vstemplate file in Visual Studio.
  4. For a Windows 8.1 store C# project, in the .vstemplate file, add the following XML within the opening and closing <TemplateData> tag: <TemplateGroupID>WinRT-Managed</TemplateGroupID>.

A C++ Windows 8.1 store project uses a value of WinRT-Native-6.3. For Windows 10 and other project types, see TemplateGroupID Element (Visual Studio Templates).

The following example shows the entire contents of a .vstemplate file after the line of XML <TemplateGroupID>WinRT-Managed</TemplateGroupID> has been added to it. This example is specific to C# projects. You can modify the and < TemplateGroupID> elements to specify other language and project types.

XML

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item"> 

  <TemplateData> 

    <DefaultName>MyItemStoreTemplate.xaml</DefaultName> 

    <Name>MyItemStoreTemplate</Name> 

    <Description>This is an example itemtemplate</Description> 

    <ProjectType>CSharp</ProjectType> 

    <SortOrder>10</SortOrder> 

    <Icon>__TemplateIcon.ico</Icon> 

    <TemplateGroupID>WinRT-Managed</TemplateGroupID> 

  </TemplateData> 

  <TemplateContent> 

    <References /> 

    <ProjectItem SubType="Designer" TargetFileName="$fileinputname$.xaml" ReplaceParameters="true">MyItemTemplate.xaml</ProjectItem> 

    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.xaml.cs" ReplaceParameters="true">MyItemTemplate.xaml.cs</ProjectItem> 

  </TemplateContent> 

</VSTemplate> 

For other possible TemplateGroupID values, see TemplateGroupID Element (Visual Studio Templates)). For the complete .vstemplate reference, see Visual Studio Template Schema Reference

  1. In Visual Studio, save the .vstemplate file and close it.
  2. Copy and paste the .vstemplate file back to the .zip file located in the ..\Users\username\Documents\Visual Studio Version\Templates\ItemTemplates\ folder.

If the Copy File dialog box appears, choose the Copy and Replace option.

You can now add an item based on this template to a Windows 8.x Store project by using the Add New Item dialog box.

For more information about parameter names, see Template Parameters.

To enable templates for specific project sub-types

  1. The development environment enables you to make project items available from the Add Item dialog box for certain projects. Use this procedure to make custom items available for Windows, Web, Office, or database projects.

Locate the ProjectType element in the .vstemplate file for the item template.

Add a ProjectSubType element immediately after the ProjectType element.

  1. Set the text value of the element to one of the following values:
    1. Windows
    2. Office
    3. Database
    4. Web

For example: <ProjectSubType>Database</ProjectSubType>.

The following example shows an item template available for Office projects.

<VSTemplate Version="2.0.0" Type="Item" Version="2.0.0"> 

    <TemplateData> 

        <Name>Class</Name> 

        <Description>An empty class file</Description> 

        <Icon>Class.ico</Icon> 

        <ProjectType>CSharp</ProjectType> 

        <ProjectSubType>Office</ProjectSubType> 

        <DefaultName>Class.cs</DefaultName> 

    </TemplateData> 

    <TemplateContent> 

        <ProjectItem>Class1.cs</ProjectItem> 

    </TemplateContent> 

</VSTemplate> 

To manually create an item template without using the Export Template wizard

  1. Create a project and project item.
  2. Modify the project item until it is ready to be saved as a template.
  3. As appropriate, modify the code file to indicate where parameter replacement should occur. For more information about parameter replacement, see How to: Substitute Parameters in a Template.
  4. Create an XML file and save it by using a .vstemplate file name extension, in the same directory as your new item template.
  5. Author the .vstemplate XML file to provide item template metadata. For more information, see Visual Studio Template Schema Reference and the example in the previous section.
  6. Save the .vstemplate file and close it.
  7. In Windows Explorer, select the files you want to include in your template, right-click the selection, click Send To, and then click Compressed (zipped) Folder. The files that you selected are compressed into a .zip file.
  8. Copy the .zip file and paste it in the user item template location. In Visual Studio 2015, the default directory is ..\Users\<username>\Documents\Visual Studio 2015\Templates\ItemTemplates\. For more information, see How to: Locate and Organize Project and Item Templates.

Một phút quảng cáo bắt đầu....

BASIAP - CÔNG NGHỆ TỐI ƯU.

Chuyên phát triển và triển khai các hệ thống phần mềm quản lý cho doanh nghiệp vừa và nhỏ trong lĩnh vực logistics xuất nhập khẩu, kho bãi, vận tải.

Các lĩnh vực phần mềm:

- Phần mềm quản lý kho dịch vụ.

- Phần mềm quản lý dịch vụ vận tải.

- Phần mềm quản lý xuất nhập khẩu.

- Các hệ thống phần mềm quản lý chuyên biệt theo yêu cầu.

HÃY LIÊN HỆ NGAY VỚI BASIAP ĐỂ XÂY DỰNG HỆ THỐNG TỐI ƯU HIỆU QUẢ DOANH NGHIỆP CỦA BẠN.

Website: basiap.com | Hotline: 0764758686 | Email: This email address is being protected from spambots. You need JavaScript enabled to view it.

Cách sử dụng ErrorProvider để kiểm tra đầu vào nhiều control

Trong lập trình C#, Visual studio đã cung cấp cho chúng ta công cụ Error Provider trong C#, để bắt lỗi các dữ liệu người dùng nhập vào trên từng control. Ví dụ: mình kiểm tra dữ liệu nhập vào có nhập hay chưa, có đúng với mask yêu cầu của mình hay không, nếu không mình sẽ chặn lại và không cho submit.

Cách sử dụng cơ bản mọi người có thể tham khảo nhiều bài viết khác theo links sau:

https://laptrinhvb.net/bai-viet/chuyen-de-csharp/---Csharp----Bat-loi-su-kien-control-su-dung-Error-Provider-trong-lap-trinh-csharp/cdc8396c504da4b6.html

http://code24h.com/c-bat-loi-su-kien-control-su-dung-error-provider-trong-lap-trinh-csharp-d24686.htm

Hôm nay, Basiap chỉ bổ sung thêm thủ thuật để validate được nhiều control cùng lúc mà đỡ phải làm từng cái một. Nguyên tắc đơn giản như sau:

- Collect hết TextBox control vào 1 list, chạy lặp để set error cho từng item. Dễ nhỉ he he.

 VD: Giống như hình sau, ta chỉ cần valid các textbox dưới đây khi nhấn nút Save.Basiap su dung ErrorProvider c#

Trước tiên xử lý nút Save nhé. Thêm điều kiện, nếu valid thì mới cho cập nhật dữ liệu
 
        private void btnSave_Click(object sender, EventArgs e)
        {
            //Check if valid input -> do save data
            if (InputValidate())
            {
                //Save data
            }

        }

Tiếp theo xử lý phương thức InputValidate. Nôm na như sau: lấy hết các textbox có tên như yêu cầu, duyệt hết đám textbox đó, nếu không input thì báo lỗi, ngược lại bỏ báo lỗi. Có thêm biến errorCount để xác định có lỗi hay không ->Return

        private bool InputValidate()
        {
            var boxes = this.Controls.OfType<TextBox>();
            int errorCount = 0;
            foreach (var box in boxes)
            {
                if ("txtAgencyCode,txtCarrierCode,txtCneeCode,txtTerm,txtFreightTerm".Contains(box.Name) 
                    && string.IsNullOrWhiteSpace(box.Text))
                {
                    errorProvider1.SetError(box, "Please fill the required field");
                    errorCount++;
                }
                else
                    errorProvider1.SetError(box, "");
            }
            if (errorCount == 0)
                return true;
            else
                return false;

        }

Chỉ có vậy thôi nhé, ngoài textbox các Control khác cũng có thể xử lý ngay trong InputValidate.Các bạn tự tìm hiểu thêm nhé.

Một phút quảng cáo bắt đầu....

BASIAP - CÔNG NGHỆ TỐI ƯU.

Chuyên phát triển và triển khai các hệ thống phần mềm quản lý cho doanh nghiệp vừa và nhỏ trong lĩnh vực logistics xuất nhập khẩu, kho bãi, vận tải.

Các lĩnh vực phần mềm:

- Phần mềm quản lý kho dịch vụ.

- Phần mềm quản lý dịch vụ vận tải.

- Phần mềm quản lý xuất nhập khẩu.

- Các hệ thống phần mềm quản lý chuyên biệt theo yêu cầu.

HÃY LIÊN HỆ NGAY VỚI BASIAP ĐỂ XÂY DỰNG HỆ THỐNG TỐI ƯU HIỆU QUẢ DOANH NGHIỆP CỦA BẠN.

Website: basiap.com | Hotline: 0764758686 | Email: This email address is being protected from spambots. You need JavaScript enabled to view it.

cấu hình hiển thị cột cho DataGridView

Lập trình C# với winform, bạn có thể gặp rất nhiều form quản lý các đối tượng có nhiều thông tin (nhiều cột). Nhưng người dùng nhiều khi không muốn hiển thị hết, họ muốn tự chọn cột và thứ tự hiển thị. Vậy đây là cách chúng ta làm.

Basiap - cấu hình hiển thị cột trên grid

Chúng ta sẽ tạo một Tool hiển thị danh sách cột, đánh dấu các cột đang hiên thị, cho phép người dùng check chọn hiển thị và thay đổi thứ tự cột trong listbox.

Bắt đầu chúng ta tạo 1 Form tên là: HeThongCauHinhCot. Viết phương thức khởi tạo với các mảng arrCol(danh sách cột), arrVisibleCol(danh sách cột hiển thị).

Tiếp theo cần xử lý để show 2 mảng vào CheckedListBox:

        public HeThongCauHinhCot(string[] arrCol, string[] arrVisibleCol)
        {
            InitializeComponent();
            clstCol.Items.AddRange(arrCol);
            for (int i = 0; i < arrCol.Length; i++)
            {
                if (arrVisibleCol.Contains(clstCol.Items[i].ToString()))
                {
                    clstCol.SetItemChecked(i, true);
                }
            }

        }

Thế là đã có danh sách cột để lựa chọn rồi nhé. Tiếp theo cần cho phép thay đổi tứ thự cột. Thêm 2 button lên xuống và viết code như sau:

        private void btnUp_Click(object sender, EventArgs e)
        {
            _MoveSelectedItem(clstCol, -1);
        }
        private void btnDown_Click(object sender, EventArgs e)
        {
            _MoveSelectedItem(clstCol, 1);

        }

        public void _MoveSelectedItem(ListBox listBox, int direction)
        {
            // Checking selected item
            if (listBox.SelectedItem == null || listBox.SelectedIndex < 0)
                return; // No selected item - nothing to do
 
            // Calculate new index using move direction
            int newIndex = listBox.SelectedIndex + direction;
 
            // Checking bounds of the range
            if (newIndex < 0 || newIndex >= listBox.Items.Count)
                return; // Index out of range - nothing to do
 
            object selected = listBox.SelectedItem;
 
            // Save checked state if it is applicable
            var checkedListBox = listBox as CheckedListBox;
            var checkState = CheckState.Unchecked;
            if (checkedListBox != null)
                checkState = checkedListBox.GetItemCheckState(checkedListBox.SelectedIndex);
 
            // Removing removable element
            listBox.Items.Remove(selected);
            // Insert it in new position
            listBox.Items.Insert(newIndex, selected);
            // Restore selection
            listBox.SetSelected(newIndex, true);
 
            // Restore checked state if it is applicable
            if (checkedListBox != null)
                checkedListBox.SetItemCheckState(newIndex, checkState);

        }

Xong vậy là chúng ta đã có thể thay đổi bị trí các cột lên hoặc xuống. Chúng ta còn phần tích hợp form này với 1 form quản lý nữa.

Nguyên tắc là Form quản lý sẽ gọi Form HeThongCauHinhCot đồng thời truyền danh sách cột của DataGridView lên để hiển thị.

Sau khi cấu hình xong cột trên HeThongCauHinhCot sẽ trả về các danh sách cột, trạng thái hiển thị để load lại DataGridView.

Phần này tùy từng màn hình mọi người xử lý tiếp nhé. Cách thức giống hêt khi cấu hình cột trong Windows Explorer.

Chỉ có vậy thôi nhé, quá dễ bạn nhỉ. Nếu khó khăn bạn vui lòng để lại tin nhắn phía dưới nhé.

Một phút quảng cáo bắt đầu....

BASIAP - CÔNG NGHỆ TỐI ƯU.

Chuyên phát triển và triển khai các hệ thống phần mềm quản lý cho doanh nghiệp vừa và nhỏ trong lĩnh vực logistics xuất nhập khẩu, kho bãi, vận tải.

Các lĩnh vực phần mềm:

- Phần mềm quản lý kho dịch vụ.

- Phần mềm quản lý dịch vụ vận tải.

- Phần mềm quản lý xuất nhập khẩu.

- Các hệ thống phần mềm quản lý chuyên biệt theo yêu cầu.

HÃY LIÊN HỆ NGAY VỚI BASIAP ĐỂ XÂY DỰNG HỆ THỐNG TỐI ƯU HIỆU QUẢ DOANH NGHIỆP CỦA BẠN.

Website: basiap.com | Hotline: 0764758686 | Email: This email address is being protected from spambots. You need JavaScript enabled to view it.

Fix lỗi Configuration System Failed to Initialize

Trong lập trình C# với Visual studio, thỉnh thoảng chúng ta gặp vài lỗi củ chuối mà trả liên quan gì đến code của bạn. Tự nhiên một ngày đẹp trời bạn sẽ gặp chúng, lỗi: "Configuration System Failed to Initialize" là một lỗi như vậy. Rất củ chuối. Nhưng cách giải quyết lại cực dễ.

Tất nhiên là Basiap sẽ hướng dẫn bạn theo cách đơn giản nhất, cách khó hơn bạn cần google thêm nhé.

Giải pháp: Deleting the Configuration file of Application

Khi Build ứng dụng, hệ thống tự đọng tạo các file config trong thư mục tạm theo các đường dẫn dưới dây:

C:\Users\<Your Username>\AppData\Local\<Your App Name>
C:\Users\<Your Username>\AppData\Roaming\<Your App Name>

Bằng một hành động vô tình nào đó file config của bạn bị lỗi (corrupted). Thế là cứ build đi build lại vẫn lỗi. Trường hợp này cách giải quyết nhanh gọn nhất là Delete luôn thư mục App của bạn đi và quay ra build lại App. Hệ thống không tìm thấy file tạm sẽ tự động tạo ra file config mới. Hệ thống sẽ chạy ngon như chưa từng xảy ra lỗi.

Basiap - Configuration System Failed to Initialize Bug

Chỉ có vậy thôi nhé, quá dễ bạn nhỉ. Các khó khăn bạn vui lòng để lại tin nhắn phía dưới nhé.

Tham khảo thêm: https://appuals.com/fix-configuration-system-failed-initialize/

 

Một phút quảng cáo bắt đầu....

BASIAP - CÔNG NGHỆ TỐI ƯU.

Chuyên phát triển và triển khai các hệ thống phần mềm quản lý cho doanh nghiệp vừa và nhỏ trong lĩnh vực logistics xuất nhập khẩu, kho bãi, vận tải.

Các lĩnh vực phần mềm:

- Phần mềm quản lý kho dịch vụ.

- Phần mềm quản lý dịch vụ vận tải.

- Phần mềm quản lý xuất nhập khẩu.

- Các hệ thống phần mềm quản lý chuyên biệt theo yêu cầu.

HÃY LIÊN HỆ NGAY VỚI BASIAP ĐỂ XÂY DỰNG HỆ THỐNG TỐI ƯU HIỆU QUẢ DOANH NGHIỆP CỦA BẠN.

Website: basiap.com | Hotline: 0764758686 | Email: This email address is being protected from spambots. You need JavaScript enabled to view it.

HIỂN THỊ DỮ LIỆU CÓ THỂ SỬA ĐỔI LÊN DATAGRIDVIEW KHÔNG DÙNG BINDING SOURCE

Trong lập trình C#, Visual studio đã cung cấp cho chúng ta công cụ DataGridView để hiển thị danh sách đối tượng cần quản lý. Thông thường để hiển thị dữ liệu lên DataGridView ta chỉ cần set DataSource là OK.

dgrData.DataSource=YourDataTable;

Tuy nhiên một số trường hợp chúng ta vừa phải hiển thị dữ liệu lên grid vừa phải cho phép edit trực tiếp trên grid trước khi lưu thông tin. Điều này không được phép nếu ta dùng DataSource. Basiap sử dụng giải pháp sau đây.

Nguyên tắc đơn giản như sau: lặp các dòng trong datatable và add vào grid.

        /// <summary>
        /// Write datatable to gridview
        /// </summary>
        /// <param name="dtData"></param>
        private void ShowDataToGrid(DataTable dtData)
        {
            //Xóa hết dòng hiện thời trên grid
            dgrData.Rows.Clear();
            //Lặp để add các dòng trong bảng vào grid
            foreach (DataRow row in dtData.Rows)
            {
                dgrData.Rows.Add(row.ItemArray);
            }

        }

Basiap tms wms web Lặp để add các dòng trong bảng vào grid

Sau khi sử dụng Method này để add dữ liệu từ bảng của bạn vào grid, bạn có thể xem và chỉnh sửa dữ liệu thoải mái và lưu lại.

Chỉ có vậy thôi nhé, quá dễ bạn nhỉ. Các khó khăn bạn vui lòng để lại tin nhắn phía dưới nhé.

Một phút quảng cáo bắt đầu....

BASIAP - CÔNG NGHỆ TỐI ƯU.

Chuyên phát triển và triển khai các hệ thống phần mềm quản lý cho doanh nghiệp vừa và nhỏ trong lĩnh vực logistics xuất nhập khẩu, kho bãi, vận tải.

Các lĩnh vực phần mềm:

- Phần mềm quản lý kho dịch vụ.

- Phần mềm quản lý dịch vụ vận tải.

- Phần mềm quản lý xuất nhập khẩu.

- Các hệ thống phần mềm quản lý chuyên biệt theo yêu cầu.

HÃY LIÊN HỆ NGAY VỚI BASIAP ĐỂ XÂY DỰNG HỆ THỐNG TỐI ƯU HIỆU QUẢ DOANH NGHIỆP CỦA BẠN.

Website: basiap.com | Hotline: 0764758686 | Email: This email address is being protected from spambots. You need JavaScript enabled to view it.

Lập trình C# - Mẹo thêm đường thẳng phân cách trên form

Trong lập trình C# với winform, nhiều khi bạn cần vẽ 1 đường thẳng ngang, dọc để phân cách các khối control. Nhưng Toolbox không có Line control cho bạn đâu. Tuy nhiên chỉ cần 1 mẹo nhỏ bạn đã có ngay Line mong muốn.

Basiap logistics software

Để tạo đường thầng trong Windows Forms, hãy sử dụng điều khiển Label. Đặt Height của nó thành 2 pixel và BorderStyle thành Fixed3D.

   [C#]

   label1.AutoSize = false;

   label1.Height = 2

   label1.BorderStyle = BorderStyle.Fixed3D;

Trường hợp đường thẳng theo chiều dọc đơn giản chỉ cần đặt Width = 2px

Chỉ có vậy thôi nhé, quá dễ bạn nhỉ. Nếu khó khăn bạn vui lòng để lại tin nhắn phía dưới nhé.

Một phút quảng cáo bắt đầu....

BASIAP - CÔNG NGHỆ TỐI ƯU.

Chuyên phát triển và triển khai các hệ thống phần mềm quản lý cho doanh nghiệp vừa và nhỏ trong lĩnh vực logistics xuất nhập khẩu, kho bãi, vận tải.

Các lĩnh vực phần mềm:

- Phần mềm quản lý kho dịch vụ.

- Phần mềm quản lý dịch vụ vận tải.

- Phần mềm quản lý xuất nhập khẩu.

- Các hệ thống phần mềm quản lý chuyên biệt theo yêu cầu.

HÃY LIÊN HỆ NGAY VỚI BASIAP ĐỂ XÂY DỰNG HỆ THỐNG TỐI ƯU HIỆU QUẢ DOANH NGHIỆP CỦA BẠN.

Website: basiap.com | Hotline: 0764758686 | Email: This email address is being protected from spambots. You need JavaScript enabled to view it.

Tăng hiệu suất load dữ liệu của DataGridView lên 10 lần

Trong lập trình C# với winform, khi bạn hiển thị dữ liệu lên DataGridView với số lượng dòng cột lớn, mỗi lần kéo dòng, cuộn cột em DataGridView lại giật giật đau hết cả mắt. Làm sao để em nó show được dữ liệu một cách nuột nà hơn.

Có nhiều cách và tất nhiên là Basiap sẽ hướng dẫn bạn theo cách đơn giản nhất. Một phát áp dụng cho toàn bộ các Grid của bạn. Bắt đầu nhé:

Bước 1: Tạo phương thức chung tăng hiệu năng DataGridView 

        /// <summary>
        /// Tang hieu nang gridview.
        /// </summary>
        public static void DoubleBuffered(this DataGridView dgv, bool setting)
        {
            Type dgvType = dgv.GetType();
            PropertyInfo pi = dgvType.GetProperty("DoubleBuffered",
                  BindingFlags.Instance | BindingFlags.NonPublic);
            pi.SetValue(dgv, setting, null);

        }

Bước 2: Áp dụng cho tất cả các Form có DataGridView. Chỉ cần đặt dòng này vào chỗ khởi tạo Form

    Commons.DoubleBuffered(dgrData, true);

Chỉ có vậy thôi nhé, quá dễ bạn nhỉ. Các khó khăn bạn vui lòng để lại tin nhắn phía dưới nhé.

Một phút quảng cáo bắt đầu....

BASIAP - CÔNG NGHỆ TỐI ƯU.

Chuyên phát triển và triển khai các hệ thống phần mềm quản lý cho doanh nghiệp vừa và nhỏ trong lĩnh vực logistics xuất nhập khẩu, kho bãi, vận tải.

Các lĩnh vực phần mềm:

- Phần mềm quản lý kho dịch vụ.

- Phần mềm quản lý dịch vụ vận tải.

- Phần mềm quản lý xuất nhập khẩu.

- Các hệ thống phần mềm quản lý chuyên biệt theo yêu cầu.

HÃY LIÊN HỆ NGAY VỚI BASIAP ĐỂ XÂY DỰNG HỆ THỐNG TỐI ƯU HIỆU QUẢ DOANH NGHIỆP CỦA BẠN.

Website: basiap.com | Hotline: 0764758686 | Email: This email address is being protected from spambots. You need JavaScript enabled to view it.

Quy trình chăm sóc khách hàng trong hệ thống quản trị quan hệ khách hàng (CRM)

Khách hàng là tài sản lớn nhất của doanh nghiệp, quản lý chăm sóc và khai thác hiệu quả được thông tin khách hàng mang lại giá trị cực lớn cho doanh nghiệp. Quy trình chăm sóc khách hàng trong hệ thống quản trị quan hệ khách hàng (CRM) là một đề tài rất được quan tâm hiện tại. Tùy vào quy mô và nguyên tác quản lý của doanh nghiệp mà quy trình và nghiệp vụ có thể thay đổi ít nhiều, tuy nhiên quy trình chính cơ bản sẽ không thay đổi. Basiap xin chia sẻ lại Quy trình chăm sóc khách hàng trong hệ thống quản trị quan hệ khách hàng (CRM) đang được ứng dụng trong rất nhiều hệ thống CRM hiện đại.

Quy trình quản lý kho sản xuất, nghiệp vụ quản lý kho sản xuất

Quy trình quản lý kho sản xuất, nghiệp vụ quản lý kho sản xuất là một vấn đề rất được quan tâm hiện tại. Tùy vào quy mô và nguyên tác quản lý của doanh nghiệp mà quy trình và nghiệp vụ có thể thay đổi ít nhiều, tuy nhiên quy trình chính cơ bản sẽ không thay đổi. Basiap xin chia sẻ lại quy trình quản lý kho cơ bản đang được rất nhiều doanh nghiệp kinh doanh kho sử dụng.

Quy trình quản lý vận tải, nghiệp vụ quản lý vận tải cho doanh nghiệp vừa và nhỏ

Quy trình quản lý vận tải, nghiệp vụ quản lý vận tải cho doanh nghiệp vừa và nhỏ là một vấn đề rất được quan tâm hiện tại. Tùy vào quy mô và nguyên tác quản lý của doanh nghiệp mà quy trình và nghiệp vụ có thể thay đổi ít nhiều, tuy nhiên quy trình chính cơ bản sẽ không thay đổi. Basiap xin chia sẻ lại quy trình quản lý vận tải cơ bản đang được rất nhiều doanh nghiệp vận tải sử dụng.