|
uSQL = "Insert Into OrderDetails2 (OrderNumber, ProductCode, ProductDesc, Quantity, Price) " & _
" Values (" & iOrderNo & ", '" & strCode & "', '" & strDesc & "', " & iQuantity & ", " & iUnitPrice & "," & iFullPrice & ")"
Set RS = Conn.Execute(uSQL)
Me.Adodc3.Refresh
Me.DataGrid2.Refresh
the above code is used to populated the datagrid first time round, by the click event of a command button. Price relates to UnitPrice*Quantity, which is calculated prior to the population of the grid, on the click of a command button. i cant edit the quantity in the datagrid directly due to the calculation that is required for FullPrice (ie Qty * Price). so instead i change the quantity in the datagrid (all other columns except FullPrice are set to locked) and press an "Edit" button which contains the following code:
Dim strCustomerCode As String
iOrderNo = txtOrderNo.Text
strCustomerCode = Me.txtCustomerCode.Text
strProductCode = DataGrid2.Columns("ProductCode")
DataGrid2.Columns("ProductCode").Locked = True
DataGrid2.Columns("ProductDesc").Locked = True
iPrice = Datagrid2.Columns("UnitPrice")
Dim iGridQty As Integer
DataGrid2.Columns("Quantity") = iGridQty
iFullPrice = iPrice * iGridQty
DataGrid2.Columns("Price") = iFullPrice
DataGrid2.Columns("Price").Locked = True
With Adodc3.Recordset
Dim editSQL As String
editSQL = "Update OrderDetails2 " & _
" Set OrderDetails2.Quantity = " & iGridQty & ", " & _
" OrderDetails2.Price = " & iFullPrice & " " & _
" where OrderDetails2.ProductCode = '" & strProductCode & "' AND OrderDetails2.OrderNumber = " & iOrderNo & ""
Set RS = Conn.Execute(editSQL)
End With
MsgBox ("Record Updated")
The record updates fine in the table but when i leave the datagrid ,i get the following error message: "Cannot be updated for updating. Some values may have been changed sinse it was last read". What am i doing wrong? If you need any more information or explanation, please let me know - any help would be greatly appreciated!
|
|
|
|
|
I'm very new to .net .... any help is much appreciated!
I'm using vb.net and visual studio.net to build a form. This form has two textboxes (textbox1 and textbox2). I'm trying to drag and drop the value of textbox2 into textbox1. Further, after the drop, I went textbox2 to retain the value of textbox1. A swap. See illustration below:
Figure 1 - The initial state of both textboxes
Textbox1 Textbox2
15 37
Figure 2 - The state of the textboxes after the drag and drop
Textbox1 Textbox2
37 <----- 15
So far, I've gotten this to work:
Textbox1 Textbox2
37 <----- 0
I've debugged what I've done so far, and checked the call stack. What's happing so far is:
1. The mousedown event occurs on textbox2. This even triggers the drag and drop event of textbox1
2. In the textbox1.drag_and_drop(), I've added some code to set textbox1.text = <new value="">
3. Control is returned back to textbox2.mousedown() where I set textbox2.text = 0
I've tried overloading the procedure textbox1.drag_and_drop() to include a 3rd, byRef, argument oldValue as String, that I set to the original value of textbox1.text. However this doesn't compile because textbox1.drag_and_drop() HANDLES dragdrop.
My question is this: What's the easiest way of getting this done? If I'm going down the right road, how do I overload the dragdrop event so that I can implement this 3rd argument? If I overload the event, do I need to recreate all the code associated with dragdrop?
|
|
|
|
|
Hi!
I'm trying to find a way of retrieving the serial number of all the hard drives in a PC, not the Volume information, but the real hard drive, manufacturer serial number!
I know i must use a virtual device driver file, but i don0y actually know how to do it!
Where can i find a sample code, or just a good article on this subject?
Thank you for your time
|
|
|
|
|
Are you using VB6 or VB.NET ?
For VB6, I would do this :
In the Menu Project->References : Select 'Microsoft Scripting Runtime'
Then in your code :
Dim fso As FileSystemObject
Set fso = New FileSystemObject
MsgBox fso.Drives("c").SerialNumber
Set fso = Nothing
I'm not sure if this is exactly what you need.
Jerome
|
|
|
|
|
Thank you Jerome
I'm using VB6, i did as you told me, and i got a number, like : 134763457, maybe this number is related to the partition serial number, because, once i have 2 partitions in this hard drive, for "e" i got another number.
What i needed is the vendors serial number that can be read on the hard drive.
Do you know a way to do this?
Thank you once more
|
|
|
|
|
I understand now exactly what you want. You're right, the number you get is the Serial number of the volume. I'm afraid I won't be able to help you on how to get the manufacturer serial number, I've got no idea how to get it...
Sorry,
Jerome
|
|
|
|
|
Thank ok, thank you the same
|
|
|
|
|
I want to set the layout orientation settings of a printer in a client machine..
using an dotnet page I have to set these property in the client machine... & then to print..
I know there we cant change programmatically the settings such as the page orientation or the default printer.
so can I use an activexControl instead or is there anyway to overcome this problem..
pls let me know..
Regards
Thoths
|
|
|
|
|
|
I'm looking for the way to create the custom menu in VS.NET for my Addin.
As you know, if you create the addin with Visual Studio.NET Addin Wizard and choose [Create the TOOL menu] then .NET generates the code in OnConnection Sub like following..
CommandObj = applicationObject.Commands.AddNamedCommand(objAddIn, "MyAddin1", "MyAddin1", Executes the mommands for MyAddin1, True, 59, Nothing, 1+2)
CommandObj.AddControl(applicationObject.CommandBars.Item("Tools"))
This will insert the MyAddin1 menu in TOOL menu when it's first loaded.
I wanna creat my custom Menu like MyAddins next to Tool menu, then insert addin's menu into it...
If anyone know the way to do it, please tell me. Thanks.
|
|
|
|
|
Hello,
In previous version of vb we used to use .inc files like .h files in c++,
how is the changed in vb.net ?
Thanks for your reply
|
|
|
|
|
Use "imports", e.g., "imports system.io"
Gerry
|
|
|
|
|
Hello gerry,
I am a C++ programmer, now in the world of VB.net
as in c++ world where we have .h files where we define
the integer,string...array etc, is there some thing
in vb.net world. where I could define all constants
and global variables and include them in all files.
or should all of them be defined in a module and include
that module in the project while compiling.
bijju
|
|
|
|
|
Not sure, Bijju.
"Imports system.io" for example imports (includes) a namespace that you can then refer to in your code, like additional classes.
system.io comes from system.dll (I believe) so you could create a DLL and then make a reference to it in your project, or you can copy a source file to your project.
I used to keep a number of "global" .h files in a special directory that I made known to the compiler, so it would know where to find it. You can probably do the same thing in vb .net, but I've only been using vb .net a month, so I'm learning as I go along.
Good luck,
Gerry
|
|
|
|
|
You used .inc files in pervisous versions of VB?
Are you sure?
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."
|
|
|
|
|
Ray Cassick wrote:
You used .inc files in pervisous versions of VB?
He must be talking about VB3. VB4 dropped the support for include files.
I see dumb people
|
|
|
|
|
Hello,
I would like to call some procedures defined in other dll or pc code
written by other vendor. how do I go about it?
for example I want to use a function in rational's dll, how do I
go it?
|
|
|
|
|
Look at the documentation for the Declare statement in the MSDN Library.
If you are using VB6, look at this[^]
If you are using VB.Net, use this[^]
--
Ian Darling
|
|
|
|
|
Hi...A databinding error messed up my form, at least from
appearances sake (please see attached picture). But when
I view the code everything seems to be there. Does anyone
know how I can get my form back?
Anyone familiar with this databinding error (DataBinding
could not find a row in the list that is suitable for all
bindings)?
Does anyone know how to configure VB.net so I can easily
change my server name (connection)? I develop on the office network
and then take it to another network to run.
Thanks in advance. Mike
|
|
|
|
|
Hello,
I need to connect to an external server from my VB application. I am using Winsock control to connect to the external server. My program runs at a scheduled time. I am not suppose to start a new schedule thread before the first one is done. How to check this using VB or Winsock?
Thanks
Hitesh
|
|
|
|
|
I am spoiled by my VC++ macros...is there a way to create and use macros in VB 6?
|
|
|
|
|
Andrew Stampor wrote:
I am spoiled by my VC++ macros...is there a way to create and use macros in VB 6?
Not directly. VB6 "addins" are the way to go to execute custom code integrated to the IDE and handle many mundane tasks. For example, our company wrote a VB addin that does some standards checking when forms are saved.
Addins have a bit of a learning curve to be properly implemented. I've had problems because I wasn't careful about properly handling the life cycle of my addin.
|
|
|
|
|
Thanks. That is what I was afraid of. Of course, they wouldn't want to make it easy.;)
|
|
|
|
|
I have seen C++ and C# examples but they are way to complex for this newcomer to vb.net. Does anybody have a sample project that I could learn from?
TIA
Gerry
|
|
|
|
|
I guess I should clarify that I can place the OpenFileDialog on the form, but my problem is first how to make it come up when I click on e button, and secondly I need to have multiple files selected go into an array.
Thanks.
Gerry
|
|
|
|