none
lable and combobox

    Question

  •  I am in need of  help to figure it out   when selecting  value form  combobox  lable  value  get clear

    Vijay Patel


    Friday, March 10, 2017 2:05 AM

All replies

  •  I am in need of  help to figure it out   when selecting  value form  combobox  lable  value  get cldear

    Vijay Patel

    Hi

    Very difficult to understand your question. As near as I can guess, maybe something like this:

    Label1.Text = ComboBox1.SelectedItem.ToString

    You can have it in the ComboBox SelectedIndex Changed event like this:

    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
        Label1.Text = ComboBox1.SelectedItem.ToString
    End Sub


    Regards Les, Livingston, Scotland



    • Edited by leshay Friday, March 10, 2017 2:16 AM
    Friday, March 10, 2017 2:14 AM
  • My question is when I select  value in  combobox the value in lable  control  clear

    Vijay Patel

    Friday, March 10, 2017 2:49 AM
  • Are you talking about the area shown below or something else?


    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, March 10, 2017 3:13 AM
    Moderator
  • I have mobile apps written in vb.net I am try to accomplish  a task   by  change value in combobox  will  remove  value  from label control

    Vijay

    Friday, March 10, 2017 2:15 PM
  • I have mobile apps written in vb.net I am try to accomplish  a task   by  change value in combobox  will  remove  value  from label control

    Vijay

    Friday, March 10, 2017 2:16 PM
  • I have mobile apps written in vb.net I am try to accomplish  a task   by  change value in combobox  will  remove  value  from label control

    Vijay

    Please do not ask the same basic question in multiple postings. I have merged the two for this reason.

    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, March 10, 2017 2:38 PM
    Moderator
  • when I  change value in combobox  will take effect on Label control(or it will need to be  empty)

    Vijay Patel

    Friday, March 10, 2017 2:40 PM
  • Example where I bind the ComboBox to a DataTable

    Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim ops As New DatabaseOperations
        ops.GetCustomerData()
        Dim dt As DataTable = ops.DataTable
        ComboBox1.DataSource = dt
        ComboBox1.DisplayMember = "CompanyName"
    
    End Sub
    Private Sub ComboBox1_TextChanged(sender As Object, e As EventArgs) Handles ComboBox1.TextChanged
        If String.IsNullOrWhiteSpace(ComboBox1.Text) Then
            Label1.Text = ""
        Else
            Dim item = ComboBox1.SelectedItem
            If item IsNot Nothing Then
                Label1.Text = CType(ComboBox1.SelectedItem, DataRowView).Row.Field(Of String)("ContactTitle")
            End If
        End If
    End Sub


    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, March 10, 2017 3:18 PM
    Moderator
  • I am struggling with is when  I click or put new Value in COmbobox , Value in label control should  disapear

    Thank you very much.


    Vijay

    Friday, March 10, 2017 5:50 PM
  • Write your code in ComboxSelectedIndex changed event

    private void comboxBox_SelectedIndexChanged(object sender, EventArgs e)
    {
       label1.Text=String.Empty
    }


    PS.Shakeer Hussain

    Friday, March 10, 2017 5:57 PM
  • I am struggling with is when  I click or put new Value in COmbobox , Value in label control should  disapear

    Thank you very much.


    Vijay

    That is what the code I presented does.


    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, March 10, 2017 6:01 PM
    Moderator
  • What have you tried?  Could you post some code for your page
    Saturday, March 11, 2017 11:17 AM
  • Please don't post multiple threads on the same question. Please do define what you mean by "mobile app" and explain what code you've tried, what results you get, and how that differs from what you want. Your other threads say you're using VS2008, which doesn't support any project types discussed in the Developing Universal Windows apps forum, but you don't give enough information to know which forum is appropriate or for anybody to provide concrete help.
    Sunday, March 12, 2017 5:10 AM