|
Sure, you need to redesign everything! First, you should start by creating simple DataAccess components. I like to do this in a standalone DLL which I can use for all my Projects.
Within the DLL, I have a public Class call "DataSource". I encapsulate ALL Connection information here and make it super simple to use. For example, "DataSource.Connect", "DataSource.DisConnect" and all error handling is done within the Class.
Now, within my "Central" project, I create 1 Public Variable (or Shared Variable in VB.NET) and place it either inside a Globals Module (in VB6) or within the MDIForm (in VB.NET as a Shared Variable). Doing this allows all my Forms to use 1 Connection link into the Database.
I will Post next the DataSource Class which I use. It is very simple to use, here's an Example:
'Initialize the Application
MainMDI.DataSource = New ActiveDataObjects.DataSource()
With MainMDI.DataSource
.DatabaseType = ActiveDataObjects.DataSource.DatabaseTypes.dbSQLServer
.Server = "(Local)"
.Database = "MyDatabase"
.UserID = "UserID"
.Password = "password"
End With
The DataSource automatically knows when to initialize a Connection if one doesn't already exist, and it knows how to Connect / DisConnect using the Proper IDBConnection Object optimized for the "DatabaseType" specified. I have Connection strings implemented for almost all DBTypes, but more can be simply Implemented by editing the DatabaseType enum and modifiying the Code (look for ConnectionStrings on www.connectionstrings.com).
|
|
|
|
|
Here's the DataSource Class:
Option Strict On
Option Explicit On
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'Imports
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports Microsoft.Data.Odbc
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'Class to encapsulate Data Access
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
Public NotInheritable Class DataSource
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
#Region "Declarations"
'Implementations
Implements IDisposable
'Enumerations
Public Enum DatabaseTypes
dbAccess
dbExcel
dbODBC
dbFileDSN
dbSQLRemote
dbSQLServer
dbSybase5
dbSybase6
dbSybase7
End Enum
Public Enum SQLProtocols
sqlNamedPipes
sqlTCPIP
sqlSPXIPX
sqlBanyanVines
sqlRPC
End Enum 'When connecting through the SQLOLEDB provider use the syntax Network Library=dbmssocn and when connecting through MSDASQL provider use the syntax Network=dbmssocn
Public Enum SecuirtyProtocols
StandardSecurity = 0
TrustedSecurity = 1
End Enum
'Property Variables
Private _Server, _RemoteServer, _Database, _DSN, _Address, _ConnectString As String
Private _User, _Password As String
Private _TimeOut, _Port As Integer
Private _UseIntegrated, _UsePrompt As Boolean
Private _Type As ActiveDataObjects.DataSource.DatabaseTypes
Private _Protocol As ActiveDataObjects.DataSource.SQLProtocols
Private _Security As ActiveDataObjects.DataSource.SecuirtyProtocols
'Variables
Private odbcCon As Microsoft.Data.Odbc.OdbcConnection
Private odbcAdapter As Microsoft.Data.Odbc.OdbcDataAdapter
Private oleCon As System.Data.OleDb.OleDbConnection
Private oleAdapter As OleDb.OleDbDataAdapter
Private sqlCon As System.Data.SqlClient.SqlConnection
Private sqlAdapter As SqlClient.SqlDataAdapter
Private bConnected, bDisposed As Boolean
#End Region
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
#Region "Properties"
'Property to Return the Connection Object
Public ReadOnly Property Connection() As System.Data.IDbConnection
Get
If (IsNothing(_ConnectString)) OrElse (_ConnectString.Length = 0) Then Exit Property
If (Not bConnected) Then Call Me.Connect() 'Determine if Connected
Select Case _Type
Case DatabaseTypes.dbAccess : If (Not oleCon Is Nothing) Then Connection = oleCon Else Return Nothing
Case DatabaseTypes.dbExcel : Return Nothing
Case DatabaseTypes.dbODBC : If (Not odbcCon Is Nothing) Then Connection = odbcCon Else Return Nothing
Case DatabaseTypes.dbSQLServer : If (Not sqlCon Is Nothing) Then Return sqlCon Else Return Nothing
Case DatabaseTypes.dbSybase5 : If (Not oleCon Is Nothing) Then Connection = oleCon Else Return Nothing
Case DatabaseTypes.dbSybase6 : If (Not oleCon Is Nothing) Then Connection = oleCon Else Return Nothing
Case DatabaseTypes.dbSybase7 : If (Not oleCon Is Nothing) Then Connection = oleCon Else Return Nothing
End Select
End Get
End Property
'PropertytoReturn the Connection String
Public ReadOnly Property ConnectionString() As String
Get
Return _ConnectString
End Get
End Property
'Property for the Database
Public Property Database() As String
Get
Return _Database
End Get
Set(ByVal Value As String)
If (Not IsNothing(_Database)) Then If (_Database.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Database = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the Database Type
Public Property DatabaseType() As DatabaseTypes
Get
Return _Type
End Get
Set(ByVal Value As DatabaseTypes)
If (_Type.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Type = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property to Return whether the Connection is Open
Public ReadOnly Property IsConnected() As Boolean
Get
Return bConnected
End Get
End Property
'Property for the Password
Public Property Password() As String
Get
Return _Password
End Get
Set(ByVal Value As String)
If (Not IsNothing(_Password)) Then If (_Password.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Password = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the Server
Public Property Server() As String
Get
Return _Server
End Get
Set(ByVal Value As String)
If (Not IsNothing(_Server)) Then If (_Server.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Server = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the SQL Server Port
Public Property ServerPort() As Integer
Get
Return _Port
End Get
Set(ByVal Value As Integer)
If (_Port.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Port = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the Security Protocol
Public Property SecurityProtocol() As SecuirtyProtocols
Get
Return _Security
End Get
Set(ByVal Value As SecuirtyProtocols)
If (_Security.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_Security = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for User Prompting
Public Property UsePrompt() As Boolean
Get
Return _UsePrompt
End Get
Set(ByVal Value As Boolean)
If (_UsePrompt.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_UsePrompt = Value
Call Me.RefreshConnectionString()
End Set
End Property
'Property for the User ID
Public Property UserID() As String
Get
Return _User
End Get
Set(ByVal Value As String)
If (Not IsNothing(_User)) Then If (_User.Equals(Value)) Then Exit Property
If (bConnected) Then Exit Property
_User = Value
Call Me.RefreshConnectionString()
End Set
End Property
#End Region
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
#Region "Methods"
'Function to Connect
Public Function Connect() As Boolean
Dim mServer As ActiveSystemObjects.Network.Server
Dim sMsg As String
Dim bServerExists As Boolean
Dim i As Integer
'Verify that there is enough info to Connect
If (IsNothing(_ConnectString)) OrElse (_ConnectString.Length = 0) Then Return False
If (bConnected) Then Return True 'Determine if the Connection already Open
'Determine if the Server is available
Try
If (Not IsNothing(_Server)) AndAlso (_Server.Length > 0) Then
mServer = New ActiveSystemObjects.Network.Server(_Server)
If (mServer.Exists) Then _Address = mServer.IPAddress : bServerExists = True
End If
Catch
Call Globals.ErrorMessage("DataSource.Connect")
Finally
mServer = Nothing
End Try
If (Not bServerExists) Then Return False
Try
Select Case _Type
Case DatabaseTypes.dbAccess, DatabaseTypes.dbExcel, DatabaseTypes.dbSQLRemote, DatabaseTypes.dbSybase6, DatabaseTypes.dbSybase7
Try
oleCon = New OleDb.OleDbConnection(_ConnectString)
oleCon.Open()
bConnected = (oleCon.State = ConnectionState.Open)
Catch
Call Globals.ErrorMessage("DataSource.Connect")
oleCon.Dispose() : oleCon = Nothing
bConnected = False
End Try
Case DatabaseTypes.dbODBC
Try
odbcCon = New OdbcConnection(_ConnectString)
odbcCon.Open()
bConnected = (odbcCon.State = ConnectionState.Open)
Catch
Call Globals.ErrorMessage("DataSource.Connect")
odbcCon.Dispose() : odbcCon = Nothing
bConnected = False
End Try
Case DatabaseTypes.dbSQLServer
Try
'Open the SQL Connection
sqlCon = New SqlClient.SqlConnection(_ConnectString)
sqlCon.Open()
bConnected = (sqlCon.State = ConnectionState.Open)
Catch
Call Globals.ErrorMessage("DataSource.Connect")
sqlCon.Dispose() : sqlCon = Nothing
bConnected = False
End Try
End Select
Catch Excp As SystemException
Call Globals.ErrorMessage("DataSource.Connect")
End Try
Return bConnected
End Function
'Routine to DisConnect
Public Sub DisConnect()
'Determine if there is a Connection String
If (IsNothing(_ConnectString) OrElse (_ConnectString.Length = 0)) Then Exit Sub
If (Not bConnected) Then Exit Sub 'Determine if Connected
'Destroy any SQL Connections
If (Not sqlCon Is Nothing) Then sqlCon.Close() : sqlCon.Dispose()
sqlCon = Nothing
'Destroy any OLEDB Connections
If (Not oleCon Is Nothing) Then oleCon.Close() : oleCon.Dispose() : oleCon.ReleaseObjectPool()
oleCon = Nothing
'Destroy any OLEDB Connections
If (Not odbcCon Is Nothing) Then odbcCon.Close() : odbcCon.Dispose() : odbcCon.ReleaseObjectPool()
oleCon = Nothing
bConnected = False
End Sub
'Function to Load an Adapter from a Configuration
Public Function LoadAdapter(ByVal ConfigPath As String, ByVal AdapterName As String, Optional ByVal Version As String = "1.0") As Data.Common.DataAdapter
Dim IAdapter As Data.IDbDataAdapter
Dim xDoc As New Xml.XmlDocument()
Dim xAdapter, xCommand, xParam As Xml.XmlNode
'Determine if the File Exists
If (Not IO.File.Exists(ConfigPath)) Then Return Nothing
'Open the BusinessObject Configuration
xDoc.Load(ConfigPath)
xAdapter = xDoc.SelectSingleNode("//DataAdapter[@Name = '" & AdapterName & "'][@Version = '" & Version & "']")
For Each xCommand In xAdapter.ChildNodes
'Determine the Type of Command
Select Case CType(xCommand.Attributes("StatementType").Value, Data.StatementType)
Case StatementType.Select
With IAdapter.SelectCommand
.CommandType = CType(CInt(xCommand.Attributes("CommandType").Value), Data.CommandType)
.CommandText = xCommand.Attributes("Text").Value
.CommandTimeout = CInt(xCommand.Attributes("TimeOut").Value)
End With
Case StatementType.Insert
Case StatementType.Update
Case StatementType.Delete
End Select
Next
End Function
'Routine to Refresh the Connection String
Private Sub RefreshConnectionString()
Dim sProvider As String
Dim sProperties As New Text.StringBuilder()
Select Case _Type
Case DatabaseTypes.dbAccess 'Access Databases
If (Not IsNothing(_Database)) AndAlso (_Database.Length > 0) Then
sProperties.Append("Provider=Microsoft.Jet.OLEDB.4.0")
sProperties.Append(";Data Source=" & _Database)
If (Not IsNothing(_User)) AndAlso (_User.Length > 0) Then sProperties.Append(";User ID=" & _User)
If (Not IsNothing(_Password)) AndAlso (_Password.Length > 0) Then sProperties.Append(";Password=" & _Password)
End If
Case DatabaseTypes.dbExcel 'Excel Spread Sheets
If (Not IsNothing(_Database)) AndAlso (_Database.Length > 0) Then
sProperties.Append("Provider=Microsoft.Jet.OLEDB.4.0")
sProperties.Append(";Data Source=" & _Database)
sProperties.Append(";Extended Properties=Excel 8.0")
'sProperties.Append(";HDR=Yes") 'First Row has Column Names
End If
Case DatabaseTypes.dbODBC 'ODBC Data Sources
If (Not IsNothing(_DSN)) AndAlso (_DSN.Length > 0) Then
sProperties.Append("DSN=" & _DSN)
If (Not IsNothing(_User)) AndAlso (_User.Length > 0) Then sProperties.Append(";UID=" & _User)
If (Not IsNothing(_Password)) AndAlso (_Password.Length > 0) Then sProperties.Append(";Password=" & _Password)
End If
Case DatabaseTypes.dbSQLServer 'SQL Server
If ((Not IsNothing(_Server)) AndAlso (_Server.Length > 0)) AndAlso ((Not IsNothing(_Database)) AndAlso (_Database.Length > 0)) Then
sProperties.Append("Data Source=" & _Server)
sProperties.Append(";Initial Catalog=" & _Database)
'Determine the Protocol to use
'Select Case _Protocol
' Case SQLProtocols.sqlBanyanVines : sProperties.Append(";Network Library=DBMSVINN")
' Case SQLProtocols.sqlNamedPipes : sProperties.Append(";Network Library=DBNMPNTW")
' Case SQLProtocols.sqlRPC : sProperties.Append(";Network Library=DBMSRPCN")
' Case SQLProtocols.sqlSPXIPX : sProperties.Append(";Network Library=DBMSSPXN")
' Case SQLProtocols.sqlTCPIP : sProperties.Append(";Network Library=DBMSSOCN")
'End Select
'sProperties.Append(";Connection Timeout=" & _TimeOut)
'Determine the Security to Use
If (_Security = SecuirtyProtocols.TrustedSecurity) Then
sProperties.Append("Integrated Security=SSPI")
Else
If (Not IsNothing(_User)) AndAlso (_User.Length > 0) Then sProperties.Append(";User ID=" & _User)
If (Not IsNothing(_Password)) AndAlso (_Password.Length > 0) Then sProperties.Append(";Password=" & _Password)
End If
End If
Case DatabaseTypes.dbSybase5
Case DatabaseTypes.dbSybase6
Case DatabaseTypes.dbSybase7
End Select
_ConnectString = sProperties.ToString
sProperties = Nothing
End Sub
#End Region
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
#Region "Class Methods"
'Initialize Class
Public Sub New()
_Type = DatabaseTypes.dbSQLServer
_Port = 1433
End Sub
'Initialize for Access Database
Public Sub New(ByVal Database As String, ByVal UserID As String, ByVal Password As String)
_Type = DatabaseTypes.dbAccess
_Database = Database
_User = UserID
_Password = Password
Call Me.RefreshConnectionString()
End Sub
'Initialize for SQL Server
Public Sub New(ByVal Database As String, ByVal Server As String, ByVal UserID As String, ByVal Password As String)
_Type = DatabaseTypes.dbSQLServer
_Server = Server
_Database = Database
_User = UserID
_Password = Password
_Port = 1433
Call Me.RefreshConnectionString()
End Sub
'Initialize for DSN
Public Sub New(ByVal DSN As String)
_Type = DatabaseTypes.dbODBC
_DSN = DSN
Call Me.RefreshConnectionString()
End Sub
'Routine to Dispose
Public Sub Dispose() Implements IDisposable.Dispose
If (Not bDisposed) Then
bDisposed = True
Call Me.DisConnect()
If (Not IsNothing(odbcAdapter)) Then odbcAdapter.Dispose() : odbcAdapter = Nothing 'Destroy any ODBC Adapters
If (Not IsNothing(oleAdapter)) Then oleAdapter.Dispose() : oleAdapter = Nothing 'Destroy any OLEDB Adapters
If (Not IsNothing(sqlAdapter)) Then sqlAdapter.Dispose() : sqlAdapter = Nothing 'Destroy any SQL Adapters
GC.SuppressFinalize(Me)
End If
End Sub
'Routine to Finalize
Protected Overrides Sub Finalize()
MyBase.Finalize()
Call Dispose()
End Sub
#End Region
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
End Class
'<<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>><<o>>
|
|
|
|
|
To make a Connection using this is simple.
Using "Option Strict":
Dim sqlCon As SQLClient.SQLConnection = Ctype(DataSource.Connection, SQLClient.SQLConnection)
Not using Option Strict:
Dim sqlCon As SQLClient.SQLConnection = DataSource.Connection
Even if you don't explicitly call "DataSource.Connect", the DataSource class knows it needs to make a Connection.
|
|
|
|
|
HI!
Is it possible to call a method (from a JAVA class) from a VB project??
When YES... please give me some examples.
thx!
|
|
|
|
|
I would use J# to compile a .NET version or JUMP to migrate it to C#.
Then, I would call it from VB.NET or try to expose it as a COM component to a VB 6.0 project.
I see dumb people
|
|
|
|
|
gicio wrote:
Is it possible to call a method (from a JAVA class) from a VB project??
Gosh, is it not possible to port the Java code to another language? Hmm, well in any case, have you tried to add a reference to it in VB? I am not sure of the COM support that Java has built into it directly.
Nick Parker
|
|
|
|
|
Nick Parker wrote:
I am not sure of the COM support that Java has built into it directly.
Nil, Nada, Nothing, Nyet, Niente.
Java supports CORBA, not COM, though there are libraries (which suck) for COM in Java.
I see dumb people
|
|
|
|
|
Daniel Turini wrote:
Nil, Nada, Nothing, Nyet, Niente.
So are you saying there isn't any.
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
Can someone explain to me how I can create a program which can have 16 tiles, each with a separate picture/image, and the user can then move the tiles around to form a 4 * 4 square. Each tile can have the image rotated by 90 degrees clockwise or 180 degrees clockwise.
If the tiles could automatically stick to each other when they get close, so that each tile is set to the same hight as it's neighbour that would be great.
Sorry, if this sounds quite easy, but I have don't do much graphics work normally.
Cheers
|
|
|
|
|
I don't know if there's a better way, but i'd implement each tile as an object(class), with a image and rotation property, and a board object with 16 panes or groupboxes. The rest is just drag and drop.
I hope that helps
Notorious SMC
Vb is as VB does
|
|
|
|
|
Don't know if you got your answer yet, but I came across an example in the book VI6 Unleashed. It isn't exactly the solution, but it demonstrates moving graphics around and locking them into place. I don't think there is an IP issue sharing this with you. I also don't know how to attach a file, so here is the source for the page in in line: (Graphics files obviously missing.) I hope it helps.
<title>Flags of Canada
Drag the flag to the
correct province or territory name.
Quebec
Manitoba
British Columbia
Saskat- chewan
Alberta
Ontario
Northwest Territories
Yukon Territory
Newfoundland
Prince Edward Island
Nova Scotia
New Brunswick
Canadian Provincial Flags
David Brooks
|
|
|
|
|
hi ,
I have two forms , from1 and form2. Form1 is having mainmenu1 and is having menuitems in it. Now when i load form1 , in the load event of form1 i do me.menuitem1.enabled = false .
this disables the menu. now i have form2.load in form1 load event.
now the problem here is that in form2 i have a button thru which i want the mainmenu of form1 should be enabled.
so i have wriiten this code behind btn _click of from2
dim frm1 as new form1
frm1.menuitem2.enabled = true
but things dont work???
can somebody plz help me??
|
|
|
|
|
This is very simple. You shout not Dim a NEW instance of your Form1 because it should already open. Instead call the controls on the already open Form:
Form1.MenuItem1.Enabled = True
|
|
|
|
|
Ok, I believe this is called a custom UITypeEditor. What I am trying to do is have a Property that can Expanded and show two Sub-properties for that one. An example of this is the "Size" Type which has an x and y properties.
I want to use this to define a Color gradient.
Example:
BackColor
StartColor
EndColor
ForeColor
StartColor
EndColor
Can anyone point me in the right direction?
|
|
|
|
|
|
I have a vc++6.0 dll(ATL COM), a method in the dll takes a Variant(of type VT_DISPATCH) parameter as input. I am using this dll in vb.Net by imptlb process. The problem is that I am unable to pass the VT_DISPATCH type to my method. I am trying to use DispatchWrapper class as per MSDN but it gives unsupported interface error. Can any one help me out, its a bit urgent. I face the same problem in c# too. A solution in c# or vb.Net will do for me ).
IDL Method Signature
====================
Compress([in,out] VARIANT* DocumentObject, [out,retval] short* retVal);
DocumentObject is of type VT_DISPATCH.
vb.Net code snippet
====================
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim Comp As New XMLCOMPRESSIONLib.JNIXMLCompressionClass()<br />
Dim XmlDoct As New Xml.XmlDocument()<br />
Dim XYZ As Short<br />
<br />
XmlDoct.Load("C:\DEXML\asdfa.xml")<br />
XYZ = Comp.Compress(DispatchWrapper(XmlDoct)) <br />
MessageBox.Show(XmlDoct.InnerXml)<br />
End Sub
I get error "Interface not supported" when I call compress with dispatch wrapper tyepcast.
|
|
|
|
|
Dear, Is there someone of you knows that how can I programmatically select all the items in a Checked List Box? I tried to do it but I couldn't find any property/method which can let me to iterate through the items of ListBox / Checked Listbox so that I may be able to select them.
Thanks for your help.
Sameers
|
|
|
|
|
Sub CheckList(ByVal lst As CheckedListBox, ByVal value As Boolean)
Dim i As Integer
For i = 0 To lst.Items.Count - 1
lst.SetItemChecked(i, value)
Next
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Thaks dear,
The same thing I did just two days ago myself. You are a little late but it is good that at least you are.
Again, Very very thanks to you,
Sameers
|
|
|
|
|
dim a as label
dim a as new label
dim a as new label()
Can I use a.text immediately after one of the 3 dim ways?
Or should I have to add a line "a=new label" before using a.text in the first dim way"dim a as label"?
I hope you know my means.
Thanks.
this is my signature for forums quoted from shog*9:
I can't help but feel, somewhere deep within that withered, bitter, scheming person, there is a small child, frightened, looking a way out.
|
|
|
|
|
After the first "dim", a is still nothing so you can't use a.text immediately. You can do so after the other two "dims", however. The recommended way is:
dim a as label = new label()
which is equivalent to the second and the third dim.
|
|
|
|
|
But in fact,I see such dim :
dim form1 as form2(form2 is an user-defined class)
and the app uses "form1.param1"(param1 is also defined in class form2) immediately,not use new pointer first.
this is my signature for forums quoted from shog*9:
I can't help but feel, somewhere deep within that withered, bitter, scheming person, there is a small child, frightened, looking a way out.
|
|
|
|
|
Does anyone know how to use the post method to get through two urls to screen scrape information from the second url?
ie - i need to post some values to get to the first url. Then to get to the second url i need to post a second set of values. It's the second url where i need to screen scrape information from. (Note i need to go through the first url in order to get to the second one)
I can get it going in VB6 but not .NET.
Any code, help or suggestions would be truly appreciated.
|
|
|
|
|
Here's[^] an MFC article that might point you in the right direction. I've used WebResourceProvider to do exactly what you want to do.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
/ravi
I never thought I would see you hanging around this forum. Kidding...
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|