Click here to Skip to main content
15,745,576 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionI am changing code from vb6 windows application to vb.net windows application..getting error on EOF. sAn unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Test.exe Additional information: Operation is not allowed Pin
Member 1075459525-Sep-17 6:27
Member 1075459525-Sep-17 6:27 
SuggestionRe: I am changing code from vb6 windows application to vb.net windows application..getting error on EOF. sAn unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Test.exe Additional information: Operation is not allo Pin
Richard Deeming25-Sep-17 6:39
mveRichard Deeming25-Sep-17 6:39 
GeneralRe: I am changing code from vb6 windows application to vb.net windows application..getting error on EOF. sAn unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Test.exe Additional information: Operation is not allo Pin
Member 1075459525-Sep-17 7:07
Member 1075459525-Sep-17 7:07 
AnswerRe: I am changing code from vb6 windows application to vb.net windows application..getting error on EOF. sAn unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Test.exe Additional information: Operation is not allo Pin
Wendelius25-Sep-17 10:16
mentorWendelius25-Sep-17 10:16 
QuestionUse a variable or text box in Sql WHERE clause Pin
Member 1300905323-Sep-17 9:31
Member 1300905323-Sep-17 9:31 
AnswerRe: Use a variable or text box in Sql WHERE clause Pin
Afzaal Ahmad Zeeshan23-Sep-17 10:28
professionalAfzaal Ahmad Zeeshan23-Sep-17 10:28 
QuestionVLC Player User-Agent for vb6 Pin
Member 1341240517-Sep-17 17:01
Member 1341240517-Sep-17 17:01 
QuestionVB Form Search XLSX Pin
Member 24539047-Sep-17 10:41
Member 24539047-Sep-17 10:41 
Hi,
In VB forms, I want to do a search of an XLSX for a part number and have the cell line shown in a textbox.
So basically I will make a textbox, type in the part number, click the search button, it will search the xlsx for the part number and show the part number in another textbox. I will probably expand on this showing the description of the part but for now I am just trying to do this (Not a message box)
Similar to the code I provided.
I know the code just reads the line given, but it is simple and that is what I am looking for, for the search.
I have been searching for this method and can't seem to find it.
(I keep seeing datagrid and datasource)
Thank-you

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1
    Dim APP As New Excel.Application
    Dim worksheet As Excel.Worksheet
    Dim workbook As Excel.Workbook

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        workbook = APP.Workbooks.Open("C:\MAIN PARTS LIST\temp.xlsx")
        worksheet = workbook.Worksheets("sheet1")

    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        TextBox1.Text = worksheet.Cells(1, 1).Value
        TextBox2.Text = worksheet.Cells(1, 2).Value
        If TextBox1.Text = ("RENT") Then
            TextBox4.Text = "TADA"

        Else
            TextBox4.Text = "NOPE"

        End If

        workbook.Close()
        APP.Quit()
    End Sub

    Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs)

    End Sub

    Private Sub TextBox4_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox4.TextChanged

    End Sub

    Private Sub TextBox2_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox2.TextChanged

    End Sub
End Class

AnswerRe: VB Form Search XLSX Pin
Richard MacCutchan7-Sep-17 19:21
mveRichard MacCutchan7-Sep-17 19:21 
AnswerRe: VB Form Search XLSX Pin
Chris Quinn7-Sep-17 20:39
Chris Quinn7-Sep-17 20:39 
GeneralRe: VB Form Search XLSX Pin
Member 24539048-Sep-17 5:54
Member 24539048-Sep-17 5:54 
Questionvb 2017 : opengl project setup ? Pin
bluatigro5-Sep-17 22:25
bluatigro5-Sep-17 22:25 
Questionvb 2017 : AI : Genetic Programming Pin
bluatigro4-Sep-17 1:33
bluatigro4-Sep-17 1:33 
AnswerRe: vb 2017 : AI : Genetic Programming Pin
Arthur V. Ratz4-Sep-17 1:59
professionalArthur V. Ratz4-Sep-17 1:59 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
bluatigro5-Sep-17 22:10
bluatigro5-Sep-17 22:10 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
Arthur V. Ratz5-Sep-17 22:40
professionalArthur V. Ratz5-Sep-17 22:40 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
Arthur V. Ratz6-Sep-17 4:49
professionalArthur V. Ratz6-Sep-17 4:49 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
Arthur V. Ratz6-Sep-17 4:56
professionalArthur V. Ratz6-Sep-17 4:56 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
bluatigro6-Sep-17 21:56
bluatigro6-Sep-17 21:56 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
bluatigro7-Sep-17 1:21
bluatigro7-Sep-17 1:21 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
Arthur V. Ratz7-Sep-17 3:15
professionalArthur V. Ratz7-Sep-17 3:15 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
Arthur V. Ratz7-Sep-17 7:44
professionalArthur V. Ratz7-Sep-17 7:44 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
bluatigro7-Sep-17 23:26
bluatigro7-Sep-17 23:26 
GeneralRe: vb 2017 : AI : Genetic Programming Pin
Arthur V. Ratz7-Sep-17 23:37
professionalArthur V. Ratz7-Sep-17 23:37 
QuestionImport Outlook calendar entries from Excel with VBscript? Pin
xs13x31-Aug-17 11:03
xs13x31-Aug-17 11:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.