locked
Assign values of checked items in a checkedlistbox to a variable RRS feed

  • Question

  • Hello, I have been searching for 2 days with no luck. How do I assign the checked items of a checkedlistbox to a variable? So basically after choosing from the checkedlistbox I click on a button and it will be assigned to a variable then it will show in my dgv,

    Here's my code:

    CLASS FILE:

    Public Class DealMetrics
       Inherits ObjectBase
    
    #Region " Properties "
       Private _metrics As String
       Public Property Metrics() As String
          Get
             Return _metrics
          End Get
          Set(ByVal value As String)
             _metrics = value
          End Set
       End Property
    
    #End Region
    
    #Region " Data Access "
    
       Protected Overrides ReadOnly Property Read As String
          Get
             ' Updated the Select Query to bring back both Fields
             Return "SELECT Metric from tblMetrics WHERE DealName = @DealName"
          End Get
       End Property
    
       Public Function ReadMetrics() As List(Of DealMetrics)
          Dim returnList As New List(Of DealMetrics)
          Dim completeData As New DataSet
    
          ' Do your initial Read from the database.
          Try
    
             Using AConnString As New OleDb.OleDbConnection(ObjectBase.ConnectionString)
                Using selectCommand As New OleDb.OleDbCommand(Read, AConnString)
                   selectCommand.Parameters.Add("@DealName", OleDb.OleDbType.VarChar, 80).Value = frmUpdateEdit.cmbDeals.Text
                   Using da As New OleDb.OleDbDataAdapter(selectCommand)
                      AConnString.Open()
                      da.Fill(completeData)
                   End Using
                End Using
             End Using
          Catch ex As Exception
             Throw
          End Try
    
          ' Check to make sure some sort of Dataset is returned
          If completeData.Tables.Count = 0 Then
             Throw New Exception("No tables exist")
          End If
    
          ' Loop through each row and return an object which has the Deals details Filled in.
          For Each row As DataRow In completeData.Tables(0).Rows
             returnList.Add(New DealMetrics(row))
          Next
    
          ' return a list of your objects.
          Return returnList
    
       End Function
    
       Public Sub New()
    
       End Sub
    
       Private Sub New(childData As DataRow)
          ' Load both properties from the Datarow
          _metrics = childData.Field(Of String)("Metric")
       End Sub
    #End Region
    
    End Class

    FORM:

     Private Sub frmUpdateEdit_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          GetDeals()
       End Sub
    
    #Region "Get Deals Details"
       Private Sub GetDeals()
          bgwDeals.RunWorkerAsync()
       End Sub
    
       Private Sub bgwDeals_DoWork(sender As Object, e As DoWorkEventArgs) Handles bgwDeals.DoWork
          Dim pdeals As New DealNames()
          _PDeals = pdeals.ReadDeals
       End Sub
       Private _PDeals As List(Of DealNames)
    
       Private Sub bgwDeals_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles bgwDeals.RunWorkerCompleted
          Try
             Dim pdeals As New DealNames()
             _PDeals = pdeals.ReadDeals
             Me.bsrcDeals1.DataSource = _PDeals
             GetMetrics()
          Catch ex As Exception
             MsgBox("ERROR : " & ex.Message.ToString)
          Finally
    
          End Try
       End Sub
    #End Region
    
    #Region "Get Metrics Details"
       Private Sub GetMetrics()
          bgwMetrics.RunWorkerAsync()
       End Sub
    
       Private Sub bgwMetrics_DoWork(sender As Object, e As DoWorkEventArgs) Handles bgwMetrics.DoWork
          Dim pMetrics As New DealMetrics
          _PMetrics = pMetrics.ReadMetrics
       End Sub
       Private _PMetrics As List(Of DealMetrics)
    
       Private Sub bgwMetrics_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles bgwMetrics.RunWorkerCompleted
          Try
             Dim pmetrics As New DealMetrics()
             _PMetrics = pmetrics.ReadMetrics
             Me.bsrcMetrics.DataSource = _PMetrics
             Me.chklMetrics.DataSource = _PMetrics
             Me.chklMetrics.DisplayMember = "Metrics"
          Catch ex As Exception
             MsgBox("ERROR : " & ex.Message.ToString)
          Finally
    
          End Try
       End Sub
    #End Region
    

    Please help I'm at my wit's end thank you

    Monday, June 22, 2020 1:48 PM

All replies

  • I have a sample project (you can view code online or clone it via GitHub extension in Visual Studio) that may be helpful which reads data from a database into a list then on a button click shows how to get all checked items strongly typed.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, June 22, 2020 2:11 PM
  • I'm not sure how to convert this to access database... Is there a way to use my existing code instead? 
    Tuesday, June 23, 2020 2:55 AM
  • Hi Ash.22,

    Thanks for your feedback.

    >>Is there a way to use my existing code instead? 

    I make a test based on your code and you can refer to the following code to show the result in datagridview.

        Private _PMetrics As List(Of DealMetrics)
        Private vavariableList As List(Of String) = New List(Of String)
        Private Sub frmUpdateEdit_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            cmbMetrics.Items.Add("A")
            cmbMetrics.Items.Add("B")
            cmbMetrics.Items.Add("C")
            cmbMetrics.Items.Add("D")
        End Sub
        Private Sub GetMetrics()
            bgwMetrics.RunWorkerAsync()
        End Sub
        Private Sub bgwMetrics_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles bgwMetrics.DoWork
            Dim pMetrics As New DealMetrics
            _PMetrics = pMetrics.ReadMetrics
        End Sub
    
        Private Sub bgwMetrics_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bgwMetrics.RunWorkerCompleted
            Try
                Dim pmetrics As New DealMetrics()
                _PMetrics = pmetrics.ReadMetrics
    
                Me.chklMetrics.DataSource = _PMetrics
                Me.chklMetrics.DisplayMember = "Metrics"
                Me.chklMetrics.ValueMember = "Metrics"
            Catch ex As Exception
                MsgBox("ERROR : " & ex.Message.ToString)
            Finally
    
            End Try
        End Sub
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            GetMetrics()
        End Sub
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            For Each itemChecked As DealMetrics In chklMetrics.CheckedItems
                vavariableList.Add(itemChecked.Metrics)
            Next
    
            Dim table As DataTable = New DataTable()
            table.Columns.Add("Metrics")
            For Each value In vavariableList
                table.Rows.Add(value)
            Next
            DataGridView1.DataSource = table
        End Sub

    Data in my access database:

    Result of my test:

    Hope it could be helpful.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, June 23, 2020 6:28 AM
  • Hmmmm how do I edit this class to make it accept a variable that's a list of string? 
    Public Sub LoadRecords(ByVal selectedDeal As String, ByVal selectedMetric As String, ByVal dfrom As Date, ByVal dto As Date)
    
          Try
    
             Using con As New OleDb.OleDbConnection(ObjectBase.ConnectionString)
                Using selectCommand As New OleDb.OleDbCommand(Me.SelectCom, con)
                   selectCommand.Parameters.Add("@DealName", OleDb.OleDbType.VarChar, 80).Value = selectedDeal
                   selectCommand.Parameters.Add("@Metric", OleDb.OleDbType.VarChar, 80).Value = selectedMetric
                   selectCommand.Parameters.Add("?", OleDb.OleDbType.Date).Value = dfrom
                   selectCommand.Parameters.Add("?", OleDb.OleDbType.Date).Value = dto
                   Using da As New OleDb.OleDbDataAdapter(selectCommand)
                      da.Fill(Me.DataTable)
                   End Using
                End Using
             End Using
          Catch ex As Exception
             'Throw
             MsgBox(ex.ToString)
          End Try
    
       End Sub
    I already tried adding As List(Of String) to selectedMetric but I am getting an error :(
    Tuesday, June 23, 2020 10:35 AM
  • Hi Ash.22,

    Thanks for your feedback.

    What‘s the query statement in 'Me.SelectCom'?

    You can consider using for-each statement. For example:

       Public Sub LoadRecords(ByVal selectedMetricList As List(Of String))
            Dim vavariableList As List(Of String) = New List(Of String)
            Try
                Using con As New OleDb.OleDbConnection(ObjectBase.ConnectionString)
    
                    'con.Open()
                    Using selectCommand As New OleDb.OleDbCommand()
                        selectCommand.Connection = con
                        selectCommand.CommandText = "SELECT Metric from tblMetrics WHERE DealName = @DealName"
    
                        For Each selectedMetric In selectedMetricList
                            selectCommand.Parameters.Clear()
                            selectCommand.Parameters.Add("@Metric", OleDb.OleDbType.VarChar, 80).Value = selectedMetric
    
                            Dim reader = selectCommand.ExecuteReader
                            While reader.Read
                                vavariableList.Add(reader(0).ToString)
                            End While
                            reader.Close()
                        Next
    
                        Dim table As DataTable = New DataTable()
                        table.Columns.Add("Metrics")
                        For Each value In vavariableList
                            table.Rows.Add(value)
                        Next
                        DataGridView1.DataSource = table
                    End Using
                End Using
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
        End Sub

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 24, 2020 3:32 AM
  • Hello, this is my select statement:

    Me.SelectCom = "SELECT * from xtblDailyData1 WHERE DealName_1 = @DealName AND Metric_1 = @Metric AND DateOfData_1 BETWEEN ? AND ?"

    The passing of the selected items in the checkedlistbox has to be on button click that's in my main form..

    I wrote a new class to fill my checkedlistbox and this works the way I want it to.

    CLASS FILE:

    Public Class MetricCheckedLB
       Inherits ObjectBase
       Private dt As DataTable
       Public Sub New()
          Me.SelectCom = "SELECT Metric from tblMetrics WHERE DealName = @DealName"
       End Sub
    
       Public Sub FillMetricCheckedLB(ByVal selectedDeal As String)
          Try
    
             Using con As New OleDb.OleDbConnection(ObjectBase.ConnectionString)
                Using selectCommand As New OleDb.OleDbCommand(Me.SelectCom, con)
                   selectCommand.Parameters.Add("@DealName", OleDb.OleDbType.VarChar, 80).Value = selectedDeal
                   Using da As New OleDb.OleDbDataAdapter(selectCommand)
                      da.Fill(Me.DataTable)
                      frmUpdateEdit.chklMetrics.DisplayMember = "Metric"
                      frmUpdateEdit.chklMetrics.ValueMember = "Metric"
    
                      For i As Integer = frmUpdateEdit.chklMetrics.Items.Count - 1 To 0 Step -1
                         frmUpdateEdit.chklMetrics.Items.RemoveAt(i)
                      Next
    
                      If Me.DataTable.Rows.Count > 0 Then
                         For i As Integer = 0 To Me.DataTable.Rows.Count - 1
                            frmUpdateEdit.chklMetrics.Items.Add((CStr(Me.DataTable.Rows(i).Item(0))))
    
                         Next
    
                      End If
                   End Using
                End Using
             End Using
          Catch ex As Exception
             'Throw
             MsgBox(ex.ToString)
          End Try
    
       End Sub
    
    End Class


    FORM:

    #Region "Get Deals Details" Private Sub G

    etDeals() bgwDeals.RunWorkerAsync() End Sub Private Sub bgwDeals_DoWork(sender As Object, e As DoWorkEventArgs) Handles bgwDeals.DoWork Dim pdeals As New DealNames() _PDeals = pdeals.ReadDeals End Sub Private _PDeals As List(Of DealNames) Private Sub bgwDeals_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles bgwDeals.RunWorkerCompleted Try Dim pdeals As New DealNames() _PDeals = pdeals.ReadDeals Me.bsrcDeals1.DataSource = _PDeals GetMetrics() Catch ex As Exception MsgBox("ERROR : " & ex.Message.ToString) Finally End Try End Sub #End Region #Region "Get Metrics Details" Private Sub GetMetrics() bgwMetrics.RunWorkerAsync() End Sub Private Sub bgwMetrics_DoWork(sender As Object, e As DoWorkEventArgs) Handles bgwMetrics.DoWork Dim pMetrics As New DealMetrics _PMetrics = pMetrics.ReadMetrics End Sub Private _PMetrics As List(Of DealMetrics) Private Sub bgwMetrics_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles bgwMetrics.RunWorkerCompleted Try Dim pmetrics As New DealMetrics() _PMetrics = pmetrics.ReadMetrics Me.bsrcMetrics.DataSource = _PMetrics selectedDeal = Me.cmbDeals.Text _dMetrics = New MetricCheckedLB _dMetrics.FillMetricCheckedLB(selectedDeal) Catch ex As Exception MsgBox("ERROR : " & ex.Message.ToString) Finally End Try End Sub #End Region #Region "Search Raw Data" Private Sub cmdSearch_Click(sender As Object, e As EventArgs) Handles cmdSearch.Click If Not Me.bgwSearch.IsBusy Then If Me.txtFrom.Text = Nothing And Me.txtTo.Text = Nothing Then MsgBox("Please check the dates.", MsgBoxStyle.Information, My.Resources._ToolName) ElseIf Me.txtFrom.Text <> Nothing And Me.txtTo.Text = Nothing Then Me.radBatch.Enabled = False Me.radIndiv.Enabled = False If Me.radBatch.Checked = True Then Me.txtTo.Text = Date.Today.ToShortDateString RunPB() selectedDeal = Me.cmbDeals.Text 'insert code here to pass checked items in checked list box to variable dfrom = Date.Parse(Me.txtFrom.Text) dto = Date.Parse(Me.txtTo.Text) Me.bgwSearch.RunWorkerAsync() ElseIf Me.radIndiv.Checked = True Then Me.txtTo.Text = Date.Today.ToShortDateString RunPB() selectedDeal = Me.cmbDeals.Text selectedMetric = Me.cmbMetrics.Text dfrom = Date.Parse(Me.txtFrom.Text) dto = Date.Parse(Me.txtTo.Text) Me.bgwSearch.RunWorkerAsync() End If Else Me.radBatch.Enabled = False Me.radIndiv.Enabled = False If Me.radBatch.Checked = True Then RunPB() selectedDeal = Me.cmbDeals.Text selectedMetric = Me.cmbMetrics.Text dfrom = Date.Parse(Me.txtFrom.Text) dto = Date.Parse(Me.txtTo.Text) 'insert code here to pass checked items in checked list box to variable Me.bgwSearch.RunWorkerAsync() ElseIf Me.radIndiv.Checked = True Then RunPB() selectedDeal = Me.cmbDeals.Text selectedMetric = Me.cmbMetrics.Text dfrom = Date.Parse(Me.txtFrom.Text) dto = Date.Parse(Me.txtTo.Text) Me.bgwSearch.RunWorkerAsync() End If End If Else MsgBox("Please wait.", MsgBoxStyle.Information, My.Resources._ToolName) End If End Sub Private Sub bgwSearch_DoWork(sender As Object, e As DoWorkEventArgs) Handles bgwSearch.DoWork _rawData = New RawData If Me.chklMetrics.Visible = True Then _rawData.LoadRecords1(selectedDeal, selectedMetric1, dfrom, dto) Else _rawData.LoadRecords(selectedDeal, selectedMetric, dfrom, dto) End If End Sub Private Sub bgwSearch_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles bgwSearch.RunWorkerCompleted Me.dgvUpdateEdit.DataSource = _rawData.DataTable Me.dgvUpdateEdit.Columns.Clear() Me.dgvUpdateEdit.ColumnHeadersDefaultCellStyle.Font = New Font("Century Gothic", 7, FontStyle.Bold, GraphicsUnit.Point) Me.dgvUpdateEdit.RowsDefaultCellStyle.Font = New Font("Century Gothic", 7, FontStyle.Regular, GraphicsUnit.Point) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Deal Name", .DataPropertyName = "DealName_1", .Width = 180, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Workstream", .DataPropertyName = "Workstream_1", .Width = 80, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Tower", .DataPropertyName = "Tower_1", .Width = 100, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Date of Data", .DataPropertyName = "DateOfData_1", .Width = 100, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Week Beginning", .DataPropertyName = "WeekBeginning_1", .Width = 100, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Metric", .DataPropertyName = "Metric_1", .Width = 120, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Metric Value", .DataPropertyName = "MetricValue_1", .Width = 100, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Multiplier", .DataPropertyName = "Multiplier_1", .Width = 120, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Multiplier Value", .DataPropertyName = "MultiplierValue_1", .Width = 100, .Resizable = DataGridViewTriState.False, .[ReadOnly] = True}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Updated Metric Value", .DataPropertyName = "UpdatedMetValue_1", .Width = 100, .Resizable = DataGridViewTriState.False, .[ReadOnly] = False}) Me.dgvUpdateEdit.Columns.Add(New DataGridViewTextBoxColumn() With {.HeaderText = "Updated Multiplier Value", .DataPropertyName = "UpdatedMulValue_1", .Width = 100, .Resizable = DataGridViewTriState.False, .[ReadOnly] = False}) StopPB() End Sub

    This is the class I am using to fill my dgv: 

    Public Class RawData
       Inherits ObjectBase
       Private dt As DataTable
       Public Sub New()
          Me.SelectCom = "SELECT * from xtblDailyData1 WHERE DealName_1 = @DealName AND Metric_1 = @Metric AND DateOfData_1 BETWEEN ? AND ?"
        
          dt = New DataTable
       End Sub
       Public Sub LoadRecords(ByVal selectedDeal As String, ByVal selectedMetric As String, ByVal dfrom As Date, ByVal dto As Date)
    
          Try
             Using con As New OleDb.OleDbConnection(ObjectBase.ConnectionString)
                Using selectCommand As New OleDb.OleDbCommand(Me.SelectCom, con)
                   selectCommand.Parameters.Add("@DealName", OleDb.OleDbType.VarChar, 80).Value = selectedDeal
                   selectCommand.Parameters.Add("@Metric", OleDb.OleDbType.VarChar, 80).Value = selectedMetric
                   selectCommand.Parameters.Add("?", OleDb.OleDbType.Date).Value = dfrom
                   selectCommand.Parameters.Add("?", OleDb.OleDbType.Date).Value = dto
                   Using da As New OleDb.OleDbDataAdapter(selectCommand)
                      da.Fill(Me.DataTable)
                   End Using
                End Using
             End Using
          Catch ex As Exception
             Throw
             'MsgBox(ex.ToString)
          End Try
    
       End Sub
    
       Public Sub LoadRecords1(ByVal selectedDeal As String, ByVal selectedMetric As List(Of String), ByVal dfrom As Date, ByVal dto As Date)
    
          Try
             Using con As New OleDb.OleDbConnection(ObjectBase.ConnectionString)
                Using selectCommand As New OleDb.OleDbCommand(Me.SelectCom, con)
                   selectCommand.Parameters.Add("@DealName", OleDb.OleDbType.VarChar, 80).Value = selectedDeal
                   selectCommand.Parameters.Add("@Metric", OleDb.OleDbType.VarChar, 80).Value = selectedMetric
                   selectCommand.Parameters.Add("?", OleDb.OleDbType.Date).Value = dfrom
                   selectCommand.Parameters.Add("?", OleDb.OleDbType.Date).Value = dto
                   Using da As New OleDb.OleDbDataAdapter(selectCommand)
                      da.Fill(Me.DataTable)
                   End Using
                End Using
             End Using
          Catch ex As Exception
             Throw
             'MsgBox(ex.ToString)
          End Try
    
       End Sub
    
    End Class

    • Edited by Ash.22 Wednesday, June 24, 2020 11:21 AM
    Wednesday, June 24, 2020 7:59 AM
  • Hi Ash.22,

    >>I wrote a new class to fill my checkedlistbox and this works the way I want it to. 

    Did you solve your problem? If your question has been answered then please click the "Mark as Answer" Link at the bottom of the correct post(s), so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 25, 2020 6:31 AM
  • Hi sir, I still need to be able to pass the checked items to a variable :(

    It has to be done on button click on my main form..

    If you will notice in my "form" codes I have there a note saying "'insert code here to pass checked items in checked list box to variable"

    That's where the passing of the checked items to my variable needs to happen :(

    Thursday, June 25, 2020 6:49 AM
  • Hi Ash.22,

    As suggested in my first reply, you can use CheckedListBox.CheckedItems Property to get the collection of checked items in this CheckedListBox, then you can handle and convert each item to the type as you want.

    If I have any misunderstanding, please provide more details about the 'variable' you want to convert and the type of items in your CheckedListBox.

    Best Regards,

    Xingyu Zhao



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 25, 2020 8:03 AM
  • Hello, this has been resolved by my colleague :)

    Thank you :)

    Thursday, June 25, 2020 10:42 AM
  • Hi Ash.22,

    I’m glad to hear that your problem has been solved. I suggest you share your solution here and mark it as answer. It will be very beneficial for other community members who have similar questions.

    Thank you and have a nice day.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 29, 2020 2:35 AM