Ask a questionAsk a question
 

AnswerC#.net user control in VB6

  • Friday, June 01, 2007 6:32 AMNeon Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I have created a simple usercontrol in c# . It consist of three textboxes.

    I have written a method in usercontrol to set the values in these textboxes

    public partial class Win : UserControl

    {

    public Win()

    {

    InitializeComponent();

    }

    private void button1_Click(object sender, EventArgs e)

    {

    textBox3.Text = textBox1.Text + textBox2.Text;

    }

    public void CalVal()

    {

    textBox1.Text = "My";

    textBox2.Text = "Name";

    textBox3.Text = "Neeraj";

    }

    }

     

    It is successfully registered as COM component .

    When i use it in VB6 i am not able to set the values in these textboxes

     

    Dim objControlNew As Try.Win

     

    Private Sub Command2_Click()

      Dim str As String
        Dim strnew As String

      Set objControlNew = New Try.Win

      Me.Controls.Add objControlNew, "dotnet"
        Me.Controls("dotnet").Visible = True
        objControlNew.CalVal
      End Sub

     

    I am just calling the method , values are set from usercontrol , but i am not able to see the values in the textboxes.

    Please help if anyone know the solution

Answers

All Replies