dcsimg
Results 1 to 5 of 5

Thread: visual basic .NET adding new data to the file

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2019
    Posts
    1

    visual basic .NET adding new data to the file

    Hello ,
    I'm just learning to program in visual basic .NET.
    I need your help. I have this code:
    Code:
    Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
    
            Dim xlappFile As Microsoft.Office.Interop.Excel.Application = Nothing
            Dim xlFile_WB As Microsoft.Office.Interop.Excel.Workbook = Nothing
            Dim xlFile_WS As Microsoft.Office.Interop.Excel.Worksheet = Nothing
            Dim xlFirstfile_WS1 As Microsoft.Office.Interop.Excel.Worksheet = Nothing
            Dim FoundRange As Microsoft.Office.Interop.Excel.Range
            Dim searchID As String
    
            searchID = TextBox15.Text
            xlFile_WB = xlappFile.Workbooks.Open("C:\Users\stich\Desktop\BAZA.xlsx")
            xlFile_WS = xlappFile.Worksheets("pierwszy")
            FoundRange = xlFile_WS.Cells.Find(What:=searchID, LookIn:=Microsoft.Office.Interop.Excel.XlFindLookIn.xlFormulas, LookAt:=Microsoft.Office.Interop.Excel.XlLookAt.xlWhole)
    
            If FoundRange Is Nothing Then
                MsgBox("nie znaleziono wyrazenia")
            Else
                FoundRange.Offset(0, 2).Value = ComboBox2.Text
            End If
            'zapis bazy danych
            xlFile_WB.Save()
            xlappFile.Quit()
    
        End Sub
    He wants to open the given excel file with a given button and search for the cell containing the text entered in texbox15. After Search for this cell in the appropriate columns, enter the values ​​from the next textboxs.
    Who will tell you how to do it?

  2. #2
    Member
    Join Date
    Aug 2018
    Location
    France, North
    Posts
    61

    Re: visual basic .NET adding new data to the file

    Hi,
    What is your issue ? You didn't succeed to open the file, find the cell or write in the following one ?
    I already done a code like this for an excel file and I will certainly be able to help you if you are a bit more specific.
    See you, Mac

  3. #3
    Member
    Join Date
    Aug 2018
    Location
    France, North
    Posts
    61

    Re: visual basic .NET adding new data to the file

    What is that ?
    I didn't understood the purpose...

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,238

    Re: visual basic .NET adding new data to the file

    Quote Originally Posted by Macronaute View Post
    What is that ?
    I didn't understood the purpose...
    That was spam, it's gone now

  5. #5
    Member
    Join Date
    Aug 2018
    Location
    France, North
    Posts
    61

    Re: visual basic .NET adding new data to the file

    Quote Originally Posted by si_the_geek View Post
    That was spam, it's gone now
    Oh right ! You are very reactive

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width