|
Paul Riley wrote:
Contrary to popular opinion, it is possible to code VB well
Fully agreed, I suppose we should watch how we talk about VB here in C++ country though.
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
plz can anybody tell me how to implement progress bar or searching icon for a sub call or procedure call.
thnx
--goodbye
|
|
|
|
|
hi all,
when i used FindFirstFile() i got the file name as ".",for the first
FindNextFile() call i got the name as ".." and for the third i got the correct one..how can i avoid the first two cases..
|
|
|
|
|
File_Name = Dir$(File_Path, vbDirectory)
Do While File_Name <> ""
If File_Name <> "." And File_Name <> ".." Then
.....
Your statements go here
.....
End If
Loop
This way i avoided the first two cases
Thanks & Regards,
Bhaskar.G
|
|
|
|
|
i think if the query is like
sCategory = "SELECT CATEGORY.CATEGORY FROM CATEGORY ORDER BY CATEGORY.CATEGORY"
in this the return type is a string and I could bind the output to a textbox and to a combobox.
now if the query is like
sCategory = "SELECT CATEGORY.* FROM CATEGORY"
then how to view the results ??
I think Datagrid should be used....well not sure
plz tell me how to bind and get the output in a datagrid ....
and do tell me how to get a value from a particular cell to use it in another query.
==thnx
waiting for a reply
|
|
|
|
|
In this example I am using the datadapter, as you can bind the whole resultset to the grid in one command, with the datareader you have to loop through the resultset.
Dim oConnection As SqlClient.SqlConnection = New SqlClient.SqlConnection()
Dim oCommand As SqlClient.SqlCommand = New SqlClient.SqlCommand()
Dim oDataTableResources As Data.DataTable = New Data.DataTable()
Dim oDataTableSites As Data.DataTable = New Data.DataTable()
Dim oDataAdapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter()
Dim sSiteName As String
Dim sResourceName As String
Const iDayLength As Integer = 86400
sSQL = "Select * from Category"
gsConnectString = " Initial Catalog=" & UCase(Trim(Me.txtDB.Text)) & _
";Data Source=" & UCase(Trim(Me.txtSVR.Text)) & _
";User ID=" & UCase(Trim(Me.txtUID.Text)) & _
";Password=" & Trim(Me.txtPWD.Text) & ";"
oConnection.ConnectionString = gsConnectString
Try
oConnection.Open()
Catch o As System.Exception
MsgBox(o.Message, MsgBoxStyle.Critical, gsMessageBoxHeader)
Me.Cursor = Cursors.Default
Exit Sub
End Try
Try
oCommand.Connection = oConnection
oCommand.CommandText = sSQL
oDataAdapter.SelectCommand = oCommand
'fill the data adapter
oDataAdapter.Fill(oDataTableResources)
'bind to the datagrid
dbgrdDataGrid.DataSource = oDataTableResources
dbgrdDataGrid.ParentRowsVisible = False
Catch o As System.Exception
MsgBox(o.Message)
Me.Cursor = Cursors.Default
End Try
I do not have any code of getting a specific cell from the grid. I am sure you will be able to find samples on the web.
YASP
|
|
|
|
|
runtime error "class does not support..."
"Class does not support automation or does not support expected interface"
I've double checked that the correct dll is being referenced, so thats not the problem, plus it works fine on my machine. On a win98 and a win2k that I've tried so far I get the above error.
Any ideas? I installed the dll with PDW so all files should be present on the users machines.....
Thanks,
ns
|
|
|
|
|
hmmm.... Is the .dll registered, that is different than just being present.
If not try this at the command prompt:
C:\[location of .dll]\ <code>regsvr32 myComponent.dll</code>
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
It is registered because I'm building it on my machine locally...
Thanks,
ns
|
|
|
|
|
ns wrote:
"Class does not support automation or does not support expected interface"
Bizarrely, this usually means that the build version of the DLL is different from the build version expected by the program.
If you have a test program for a DLL that you've rebuilt, you need to rebuild the program too.
Paul
|
|
|
|
|
Really I am rebuilding each time, and I know its connnected to the new dll because I'll put in identifying msgboxes in the new dll. But thanks for the answer....
Thanks,
ns
|
|
|
|
|
No problem.
I still think you'll find it's something along these lines. I had a bizarre fault once with an InstallShield Automation DLL.
I wrote a couple of programs using v7.0.1. When I upgraded to v7.0.2, the austomation programs stopped working; the two DLLs were byte-for-byte identical except for the version number. I tried rebuilding with no luck.
Eventually, I switched the DLL back to v7.0.1 and everything worked fine.
When I later upgraded to 7.0.3, the programs rebuilt and worked fine.
Go figure.
Paul
|
|
|
|
|
This is a dll that I wrote though. It gets into the dll, executes one step of the loop, then the error pops up. I have a progress bar in the calling app thats getting updated bythe dll, so thats why I know its gone one step...because the bar has one little block in it...
Thanks,
ns
|
|
|
|
|
Very bizarre. Sorry, you're out of my depth
Paul
|
|
|
|
|
see my latest post --maybe it'll be clear to you exactly whats happening...
Thanks,
ns
|
|
|
|
|
Dim Conn1 As New ADODB.Connection
Dim Cmd1 As New ADODB.Command
' Dim Errs1 As Errors
Dim Rs1 As New ADODB.Recordset
Dim adoField As ADODB.Field
MsgBox "in pop"
AccessConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + dataBaseName
Conn1.ConnectionString = AccessConnect
Conn1.Open
MsgBox 1 'fires
Cmd1.ActiveConnection = Conn1
MsgBox 2 'doesnt fire
Cmd1.CommandText = "SELECT * FROM tblTest"
I packaged the dll with PDW so I dont know whats missing....
My references are ado 2.7 library, and MMS extension 2.7 for dds and security. These went along in the cab I think (I saw the adox in PDW list)
Thanks,
ns
|
|
|
|
|
No idea.
I would have done this differently:
Dim Cmd1 As New ADODB.Command
AccessConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + dataBaseName
Cmd1.ActiveConnection = AccessConnect
Cmd1.CommandText = "SELECT * FROM tblTest"
' blah blah blah
Set Cmd1.ActiveConnection = Nothing purely because I'm lazy and this does all the work (opening connections) for you. However, as far as I can see, you should be able to do it that way.
Here's a strange idea... have you tried
Set Conn1.ConnectionString = AccessConnect
?
Paul
|
|
|
|
|
I had referenced the ado 2.7 library . My target had 2.5 on it. PDW didnt update the mdac on the target. So, I built the dll with the 2.5 ADO library instead and it works. Only problem is that PDW while installing the dll told me there was an error registering msado25.tlb, which is use by other parts of my program so I have to check and see if they work...
Thanks so much for your input.
Thanks,
ns
|
|
|
|
|
HA! Told you it was DLL versioning
Seriously though, I can see why that was confusing. I'd have expected it to fall on the Connection object.
Glad you got there.
Paul
|
|
|
|
|
I need the form to .show and not .hide, but the user shouldnt bec able to see it. How do I position it off the screen? In code or manually or both?
Thanks,
ns
|
|
|
|
|
Are you only trying to get the form to call Form_Activate() and not be visible?
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
No. I will trigger the click event of a button on the form - thats my only avenue of siganlling VB remotely to do something. So the form and button should be off in the ozone somewhere...if I .hide it the click wont happen..
Thanks,
ns
|
|
|
|
|
How do you get the handle of say a button on a VB form once you have its handle by locating it on the desktop with its caption?
Thanks,
ns
|
|
|
|
|
Hi !
Using VB6, in a standard EXE app, I'm trying to add in a collection elements of my own type :
<br />
Option Explicit<br />
<br />
Private m_colMyCol As Collection<br />
<br />
Private Type MyType<br />
lLong As Long<br />
iInteger As Integer<br />
sString As String<br />
End Type<br />
<br />
Private Sub Form_Load()<br />
Dim l_lRec As MyType<br />
Set m_colMyCol = New Collection<br />
<br />
l_lRec.iInteger = 1<br />
l_lRec.lLong = 10<br />
l_lRec.sString = "Hello"<br />
m_colMyCol.Add l_lRec<br />
<br />
MsgBox m_colMyCol.Count<br />
End Sub<br />
When I run this sample code, I get this error :
Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types
I tried to put the type declaration as Public in a module, but I still get the same message.
Anyone got an idea what I'm doing wrong ?
Thanks !
Jerome
|
|
|
|
|
Yes, it can't be done. The only way I was able to do this was to Create a simple Class module and store the Class Objects within the Collection.
1.) Create a Class in your App.
2.) Create the Properties
Public ID As Long
Public intCounter As Integer
Public Key As String
That's it! Just create new instances of the class and store them in the Collection.
|
|
|
|