How do i do app.path in VB.NET
Hi all,
How can i use App.path in VB.NET.App gives error as name 'App' is not decalred.
what shall i do.
I tried to import system.windows.Forms.application
but i could not make it correct.
Pl give me a solution
Dim Conn As ADODB.Connection
Dim objword As Word.Application
Conn = New ADODB.Connection()
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.path & "\testdb.mdb;Mode=Share Deny None"
Conn.Open()
Thanks.
Thanks>it works fine but facing new problem
Hi,
Thanks .It works well now but facing new problem.
When i try to run the program it could not find the database application path and gives an error
the error is:
'System.runtime.interopservices.comException'occured in MArana form.exe
additional inforamtion for error is:
pl check the path name and spelled correctly.
the code:
Imports System.IO
Imports System.Reflection
Imports System.Windows.Forms.Application
Imports System.Runtime.InteropServices.COMException
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mAppPath As String
mAppPath = System.Reflection.Assembly.GetExecutingAssembly.Location
Dim Conn As ADODB.Connection
Dim objword As Word.Application
Conn = New ADODB.Connection()
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mAppPath & "\testdb.mdb;Mode=Share Deny None"
Conn.Open()
thanks
where shall i store mdb file in VB.NET
I have stored my testdb.mdb file in maranaform folder. and sametime i stored in bin folder also.But i am facing same problem.
the error is:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in MaranaForm.exe
Additional information: 'C:\ram\mortgage\MaranaForm\bin\MaranaForm.exe\testdb.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
the code is:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mAppPath As String
mAppPath = System.Reflection.Assembly.GetExecutingAssembly.Location
Dim Conn As ADODB.Connection
Dim objword As Word.Application
Conn = New ADODB.Connection()
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mAppPath & "\testdb.mdb;Mode=Share Deny None"
Conn.Open()
Please give me a solution.
Thanks.