Results 1 to 7 of 7

Thread: How do i get the value from the list in label?

Hybrid View

  1. #1
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do i get the value from the list in label?

    CSharp Code:
    1. this.BindingSource1.DataSource = myObj.GetDepartmentsByUserID();
    2. this.Label1.DataBindings.Add("Text", this.BindingSource1, "SomeProperty");
    That will then display the value of the SomeProperty property of your list items in the Label. To navigate the list you would set the Position property of the BindingSource or call a method like MoveNext.

    That said, your code makes no sense to me. Why does your method have two arguments that never get used?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    63

    Re: How do i get the value from the list in label?

    My UI code is in VB not in c# where i am binding the lable.Can you please give me the code in vb?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width