|
All you need to do to check that the user clicked on the header column is to have a condition that checks that the fgrid.MouseRow = 0, and to read the column clicked on use fgrid.MouseCol. Both are 0 based.
Cheers
|
|
|
|
|
i know that it is possible to disable a column in a datagrid by using Datagrid1.Columns("Field").Locked = true. is it equally possible to disable a row? for example, i wish to disable a row in 2 of the values in the row are the same (quantity and quantity in), but i do not know how to reference it. The only other column in the row is Product Code which is unique. is there any way to do it - thanks in advance for any help!
|
|
|
|
|
With Adodc4.Recordset
.MoveFirst
Do While Not .EOF
Dim strPriceCode As String
strPriceCode = DataGrid1.Columns("PriceCode")
Dim codeSQL As String
codeSQL = "Select PriceCode " & _
" From PriceDescription " & _
" Where PriceCode = '" & strPriceCode & "'"
Set RS = Conn.Execute(codeSQL)
If RS.BOF And RS.EOF Then
MsgBox " '" & strPriceCode & "' Price code does not exist - please try another", vbExclamation, "Invalid data"
End If
DataGrid1.Columns("Price") = txtTest.Text
If Not IsNumeric(Me.txtTest.Text) Then
MsgBox "Please enter a valid value for Quantity", vbExclamation, "Missing Quantity"
Exit Sub
End If
Dim cPrice As Currency
cPrice = DataGrid1.Columns("Price")
'updating the price table
Dim updateSQL As String
updateSQL = "Update Price set price = " & cPrice & " " & _
" where PriceCode = '" & strPriceCode & "' " & _
" AND ProductCode = '" & strProductCode & "'"
Set RS = Conn.Execute(updateSQL)
.MoveNext
Loop
End With
to (attempt to!) explain the above code, i am saving 1 column of a datagrid, and looping through it by means of the Recordset that it is bound to at run time. However, i want to ensure that the value entered at each record is a numberic value, so it has to be included in the loop as can be seen above. However, when i try to run it ( and enter a non-numeric value to test it) i get the following error " Multiple step operation generated errors - check each status value"....is there anything i can do to fix this? if you need any additional information, please let me know! Thanks in advance!
|
|
|
|
|
im new to programming...
but couldn't you use the IsNumeric() function, if u get true back, just convert it to whichever type u need? CInt, CSng, CDec...etc.
Sorry if i don't know what i'm talking about
______________________________________________
"I'm not me when I dream...anymore." -TRUSTcompany
|
|
|
|
|
Hi,
I want to display a MDI form form ActiveX control. Do U have any idea how to do that? I know it's possible in VB.NET but I want to do it in VB.6.0
Uttam
Regards;
Uttam Kumar
|
|
|
|
|
I have looked into all the crazy ways of doing this and the best that I can find is to create your 'MDI Form' as a usercontrol, then load it onto a real MDI Child form in the parrent application.
The only other thing that you will need to figure out is how to build and destroy menus on the child form if you need them.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Hi,
Thanks a lot for the help but I'm bit lost can U plz send me a sample code?
Lot of thanks in advance.
Uttam
Regards;
Uttam Kumar
|
|
|
|
|
I sent the sample app to first email address on the contact page of your website.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Uttam Kumar,
You cannot do this in native VB6 functionality. However, there are some OCX's out on the Internet that will allow you to do this relatively easily.
Good Luck,
Tony
|
|
|
|
|
Hi,
I need to implement "Back" and "Forward" button functionality (as seen in browser) in my application.
I have general idea about how to implement it(using either stacks or an array) but am wondering if there is any article or code snippet which shows how do it.
Any help is appreciated.
Thanks.
Vidvan
|
|
|
|
|
What are you working with, could you be a little more explicit?
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|
|
I am using VB.Net to write an application which can automatically send an email. I don't want to restrict my program by usign Outlook only. Is there any other way to send an email, say through an mail server??
Any help or pointers is greatly appreciated!
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
I am having a problem in vb 6 in trying to access the content of recordsets which store the results of a query. When I try to pull the value out of the recordset as in dim value = rs!key, I get an error saying that the recordset is empty (I test the BOF and EOF and I get both to be true for the rs), - (the code crashes and gives this error at rs.MoveFirst), however when i click on debug and go into the code, the rs fills and the code continues to the end successfully. I am also getting this problem in a different context where in trying to insert records into a table, recordsets are updating and reading too slowly so old values are being inserted into tables generating errors. I only get these errors when I run the code, but If i step through I get NO errors! Please help!
|
|
|
|
|
If rs.BOF AND rs.EOF are both true then the rs is either nothing or empty. In which case don't let your code use the rs.
Sounds like the underlying db has just been populated and you are attempting to get records from it before the db has finished updating itself i.e. after data has been sent to it. Are you using Access by any chance? Try putting a wait in your code after the db has been populated.
|
|
|
|
|
|
Yes I am using an Access Db. Could you give me an example of using the wait code for recordsets or after the db has been populated? I was looking on the net and could not find anything! Thanks so much for your help! Looking forward to your response!
|
|
|
|
|
The correct solution to your problem would be to open an asyncronous connection and then when you have written your data to the db wait until the connection has finished executing the SQL command.
Use the ADO const dbRunAsync when opening the connection to get an asyncronous connection. Then write the data to the db, and wait by using a loop such as:
Do While Con.StillExecuting<br />
...<br />
Loop
When the loop exits the db has been updated and you can then retrieve the required data.
HTH
|
|
|
|
|
I am attempting to connect to an Access Database with not much data and am using MDAC version 2.70.7713.4...I have worked around the problem. I noticed that the record I was querying for and then using movefirst to retrieve, was added immediately prior to performing the query for the value associated with the record added.
Before:
'If record did not exist then add record
Dim rs As New ADODB.Recordset
SQL = "TableName"
rs.Open SQL, dbMasterConn, adOpenKeyset, adLockOptimistic, adCmdTable
rs.Addnew
rs!code = varCode
rs.Update
'Following this a rs was filled for generic instances where record did or did not exist for the record just added. Record was only added if it did not exist but the code is needed regardless of whether record did or did not exist
Dim rs As New ADODB.RecordSet
rs.Source = "SELECT code FROM TableName where condition"
rs.CursorType = adOpenForwardOnly
rs.ActiveConnection = dbMaster
rs.Open
rs.MoveFirst <--it stuck here
CodeNeded = rs!code
After changes:
'If record did not exist then
Dim rs As New ADODB.Recordset
rs.ActiveConnection = MasterDb
SQL = "TableName"
rs.Open SQL, , adOpenKeyset, adLockOptimistic, adCmdTable
rs.Addnew
rs!code = varCode
rs.Update
CodeNeeded = varCode
else(if record already exists)
Dim rs As New ADODB.RecordSet
rs.Source = "SELECT code FROM TableName where condition"
rs.CursorType = adOpenForwardOnly
rs.ActiveConnection = dbMaster
rs.Open
rs.MoveFirst <--no longer stuck here and ran.
CodeNeded = rs!code
A very good detailed link that helped with making connections, creating recordsets, reading and adding values to recordsets etc for both DAO and ADO was:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acchap2.asp
|
|
|
|
|
Hi!
I've a .exe program writen in ANSI C that returns the real hard drive serial member.
From VB i'm calling it doing like:
MyApp = Shell("Diskid32.exe", 0), but Shell function returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero, but not the programs output!
Can anyone help me with this?
Thank you for your time
|
|
|
|
|
|
Thank you for answering but what i need is the manufacturer serial number not the volume's!
If i know a way of doing it with VB please tell me!
|
|
|
|
|
|
Well, I found the source for the utility your using. It's at http://www.codeguru.com/system/DiskId32.shtml. The only problem is, your going to have to recode it to be directly usable in VB, possibly as a DLL.
The easier way to do it is to pipe the output from the program to a text file with something like: MyApp = Shell("Diskid32.exe > log.txt", 0) You might have to use another method to get this to launch properly. But, in any case, what your going to have to do is open the log.txt file and parse it up to pull the information out of it.
It's better than writing a custom DLL to do the job...
|
|
|
|
|
Thank you all!
What i did was: I edited the c++ code to write the hard drive serial number to a file, that is imediatilly read and erased from the vb code, its not the best solution but i guess it shall work...
Thank you once more
|
|
|
|
|
Does anyone have or know where I can get hold of a ListView control which can be used in VB6 with the capability of multi-line ColHeading's?
If not I will see about creating my own, in C++ for use in VB6.
|
|
|
|