vb.net使用拖放控件创建填充空白

时间:2020-04-15 13:50:56

标签: vb.net drag-and-drop

Link- Its is VB6 Code. I am unable to implement/convert/understand it in VB.NET and the code is beyond my level. This VB6 project works fine

我想要在VB.NET中具有相同数据库的上述工作项目。

Public Class Form1
    Dim strque = "Fill in ** whole **,**,**"
    Dim strquestion As String
    Dim i As Integer = 1
    Dim b As Integer
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        strque = Replace(strque, "**", "***************")
        Label1.Text = strque
        SurroundingSub()
        labelc()
    End Sub



 Sub labelc()

        For i = 1 To b Step 1
            Dim Label As New Label
            Label.Name = "Label" & i
            Label.Size = New Size(170, 20)
            Label.Location = New Point(200, (90 + (i * 25))) ' Location needs to be placeholder's location
            Label.Text = "Lbl_" & i
            Me.Controls.Add(Label)
        Next

    End Sub


    Private Sub SurroundingSub()
        Dim mysplit As Array
        mysplit = Split(strque, "***************")
        'MsgBox(mysplit.Length - 1)
        b = (mysplit.Length - 1) 'Getting Number of occurances to create those many labels at runtime.
    End Sub

我的项目只有一个问题,但可能有很多空白(**)。我想创建相同数量的容器/占位符,并希望从给定的选项(标签)中进行拖放。

我不是专家。

0 个答案:

没有答案