Answered Read or get cell value (Excel)

freddyboy

Active member
Joined
Jun 18, 2020
Messages
27
Programming Experience
Beginner
Good evening, I am quite new to VB. I will try to describe as best as I can what I am trying to do.

I have a treeview called "TreeView_Insp_Records". It has several nodes and each nodes text has been renamed by inspections records names. For exemple ( Insp_blabla1, Insp_blabla2, and so on).
Theses inspections can all be found on my excel document shee1. I would like to be able to select the inspection node in the treeview, so that vb search the exact string match on the 1st column and for exemple return the value for column3 (barsalon) in a textbox.
Can I get a hand ?

Column1 (Insp Records)Column2 (Insp Name)Column3 ( Company)Column4 (numbers)
Insp_blabla1fredbarsalon345-334-3333
Insp_blabla2
Insp_blabla3
and so on

 
Don't change the code I gave you. After this, you need to read MSDN docs on how to pass parameters to methods. You are seriously lacking the basic understanding of the most simplest steps. Googling your way through a project is the worst way to learn programming. And I am not in a habit of helping copy/paste programmers, as it serves no purpose. I also have no idea if this is going to work, as your code is one awful mess. And this :
VB.NET:
        Dim thread2 As New Thread(Sub() Clearalltxtboxthread(String.Empty))
        thread2.Start()
does not belong in the after select event. Move it to a button. You are setting the values and then automatically clearing them. I'm done here.

VB.NET:
    Dim MonThread As New Thread(AddressOf Rangeloops)
    Public Delegate Sub Callback(ByVal s As Control, ByVal v As Object)
    Dim Thread2 As New Thread(AddressOf Clearalltxtboxthread)
    Private Sub UpdateUI(ByVal this_Control As Control, ByVal vRange As Object)
        this_Control.Text = CType(vRange, String)
    End Sub
    Private Sub TreeView_Insp_Records_AfterSelect(sender As System.Object, e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView_Insp_Records.AfterSelect

        Dim thread As New Thread(Sub() ExecuteWork(e.Node.Text))
        thread.Start()

        Dim thread2 As New Thread(Sub() Clearalltxtboxthread(String.Empty))
        thread2.Start()
        Ping_network()
    End Sub

    Private Sub Clearalltxtboxthread(ByVal text As String)
        txtNodeTextSearch.Invoke(New Callback(AddressOf UpdateUI), txtNodeTextSearch, String.Empty)
        TextBox_RDIMS.Invoke(New Callback(AddressOf UpdateUI), TextBox_RDIMS, String.Empty)
        TextBox_RSIG.Invoke(New Callback(AddressOf UpdateUI), TextBox_RSIG, String.Empty)
        TextBox_LocationNAME.Invoke(New Callback(AddressOf UpdateUI), TextBox_LocationNAME, String.Empty)
        TextBox_Railway.Invoke(New Callback(AddressOf UpdateUI), TextBox_Railway, String.Empty)
        TextBox_Type.Invoke(New Callback(AddressOf UpdateUI), TextBox_Type, String.Empty)
        TextBox_ABC.Invoke(New Callback(AddressOf UpdateUI), TextBox_ABC, String.Empty)
        TextBox_issue.Invoke(New Callback(AddressOf UpdateUI), TextBox_issue, String.Empty)
        TextBox_InspFROM.Invoke(New Callback(AddressOf UpdateUI), TextBox_issue, String.Empty)
        TextBox_InspTO.Invoke(New Callback(AddressOf UpdateUI), TextBox_InspTO, String.Empty)
        TextBox_Total_Insp.Invoke(New Callback(AddressOf UpdateUI), TextBox_Total_Insp, String.Empty)
        TextBox_Date.Invoke(New Callback(AddressOf UpdateUI), TextBox_Date, String.Empty)
        TextBox_Year.Invoke(New Callback(AddressOf UpdateUI), TextBox_Year, String.Empty)
        TextBox_Lead_RSI.Invoke(New Callback(AddressOf UpdateUI), TextBox_Lead_RSI, String.Empty)
        TextBox_2nd_RSI.Invoke(New Callback(AddressOf UpdateUI), TextBox_2nd_RSI, String.Empty)
        TextBox_Letterofconcern.Invoke(New Callback(AddressOf UpdateUI), TextBox_Letterofconcern, String.Empty)
        TextBox_Prenotice.Invoke(New Callback(AddressOf UpdateUI), TextBox_Prenotice, String.Empty)
        TextBox_notice_order.Invoke(New Callback(AddressOf UpdateUI), TextBox_notice_order, String.Empty)
        TextBox_AMP.Invoke(New Callback(AddressOf UpdateUI), TextBox_AMP, String.Empty)
        TextBox_NAIAT.Invoke(New Callback(AddressOf UpdateUI), TextBox_NAIAT, String.Empty)
        TextBox_letterofwarning.Invoke(New Callback(AddressOf UpdateUI), TextBox_letterofwarning, String.Empty)
        TextBox_Comments.Invoke(New Callback(AddressOf UpdateUI), TextBox_Comments, String.Empty)
        TextBox_selectednodes.Invoke(New Callback(AddressOf UpdateUI), TextBox_selectednodes, String.Empty)
        TextBox_insp_type.Invoke(New Callback(AddressOf UpdateUI), TextBox_insp_type, String.Empty)
    End Sub
 
Back
Top