Your Wisej.NET questions, answered – powered by AI!

The search bar in the Wisej.NET documentation is now powered by GitBook Lens. It reads your question, scans the Wisej.NET documentation, and produces an answer written in plain English. It even suggests follow-up questions and provides links to the relevant documentation.

Try it out! Go to docs.wisej.com/

Click on the search bar in the upper right-hand corner and type in a question, then click “Lens” or hit enter.

1

Just hit “Enter”- the magic of AI is working on an answer to the question.

2

It produced an answer!

You can click on “Answer based on X sources” at the bottom, to get links to the relevant documentation that answers your question.

3

Note that due to the nature of the AI it runs on, either changing the wording of the question slightly or even re-asking the same question can give a different answer. So if you get an answer that’s close, but not quite what you’re looking for, revise your question and ask again. Don’t be surprised if you ask the same questions as seen in this blog post and get slightly different code snippets in your answers.

Here are a few questions we asked it, and the corresponding answers:

How can I show a Progressbar in a DataGridViewCell?

4

(Notice that it also recommends three related questions- “How can I customize the appearance of a DataGridView in Wisej?”, “How can I add custom controls to a DataGridView in Wisej?” and “How can I bind data to a DataGridView in Wisej?)

We can take the code snippet from the answer and add it to the Page1_Load function:

private void Page1_Load(object sender, System.EventArgs e)
{
 dataGridView1.RowCount = 2;
 dataGridView1.ColumnCount = 2;

 var progressBar = new ProgressBar();

 progressBar.Minimum = 0;
 progressBar.Maximum = 100;
 progressBar.Value = 50;

 dataGridView1.Rows[0].Cells[0].Control = progressBar;
}

In order for the code snippet to work, a DataGridView was created in the designer (dataGridView1). The RowCount and ColumnCount properties must be set- if the datagridview doesn’t have any rows or columns, you can’t add a ProgressBar to one of the cells!

See the full example here.

Here’s what the DataGridView with the ProgressBar looks like:

5

How can I sort values in a DataGridView?

6

How can I create a composite control that includes a DateTimePicker and a checkbox?

7

Here’s the entire code snippet from that answer:

public class DateTimePickerWithCheckbox : Control
{
    private DateTimePicker _dateTimePicker;
    private CheckBox _checkBox;

    public DateTimePickerWithCheckbox()
    {

        _dateTimePicker = new DateTimePicker();
        _checkBox = new CheckBox();

        _checkBox.CheckedChanged += (sender, args) =>
        {
            _dateTimePicker.Enabled = _checkBox.Checked;
        };

        Controls.Add(_dateTimePicker);
        Controls.Add(_checkBox);

    }

    public DateTime Value
    {
        get => _dateTimePicker.Value;
        set => _dateTimePicker.Value = value;
    }

    public bool Checked
    {
        get => _checkBox.Checked;
        set => _checkBox.Checked = value;
    }
}

In order to get the code snippet to work, you’ll need to create a class that derives from UserControl and add two fields:

DateTimePicker dateTimePicker1;
CheckBox checkBox1;

You can see the full example here.

Note that this feature runs on the Wisej.NET documentation and is meant for questions about Wisej.NET. Unfortunately, if you want to find the meaning of life, you’ll have to look elsewhere.

8