|
In VB6, Long was a 32-bit integer. In VB.NET, Long is a 64-bit integer, and Integer is the 32-bit integer. Unless you're working on a 64-bit version of Windows, you need to use 32-bit integers:
Public Declare Function PostMessage _
Lib "user32" _
Alias "PostMessageA" _
(ByVal hwnd As IntPtr, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer) As Integer
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hello all,
Is there a way in VB 6.0 to make the system wait for a bit.
Like system.wait(1000) where it will wait 1000 ms or something? I suppose I could write a for loop for 1 to SomeBigNumber and every 1000 do what I want to do, but this seems like a silly way to do things.
Let me know please if there is a wait command.
Thanks!!
Oh yeah one other quick question. When I run my VB program, the Focus doesn't automatically start on the command button, like I would like. I went to the form load area and wrote
cmd_calc.SetFocus (hoping that this would set focus to my command button)
It gives me an error sayign invalid procedure call or argument. How can I get the focus to start on my command button?
Again thank you very much!
NickOne
|
|
|
|
|
NickOne wrote:
Is there a way in VB 6.0 to make the system wait for a bit.
Look in the SDK for the Sleep Win32 API call
Look here for an example:
http://www.buygold.net/v02n11/v02n11.html[^]
NickOne wrote:
It gives me an error sayign invalid procedure call or argument. How can I get the focus to start on my command button?
Place the setfocus call in the formActivate event. The form load event fires as the form is being built and the control might not be available at that point yet.
It will also help if you have all the controls Tab orders and indexes set properly.
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, I 'm new to programming and I 'm having this problem with visual basic.
I have a DB combo which has a datasource. The datasource is an array eg. data(0)
I have set the rowsource and listfield property to fill up my combo.
When I 'm trying to change the recordsource of my data control writing for example
data(0).recordsource = "Select * From Products where Productname = CPU"
and then trying to refresh my datasource
data(0).refresh
i got the following error
Run-time error '3061':
Too few parameters. Expected 1.
Can somebody help me please ???
Best Regards
Mike Economou
|
|
|
|
|
;PI declare my procedure like:
Private Sub childTreeViewProject_DoubleClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles childTreeViewProject.DoubleClick
It doesn't work,
saying methods haven't the same signatures.
|
|
|
|
|
The event is Control.DoubleClick and is an EventHandler, meaning that the second parameter is an EventArgs.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
i have successfully generated a report based on grouping. However, when i try to generate a report based on subgroups, i get returned with this error: "report sections do not match data source". why is this? here is my code in the form:
Load deTypeCustomerReport
With deTypeCustomerReport
.TypeCustomerReport_Grouping CDate(Text1.Text)
End With
rptTypeCustomerReport.Refresh
If rptTypeCustomerReport.Visible = False Then
rptTypeCustomerReport.Show
End If
i have placed 1 field (company) in one of the group headers, the other (ProductType) in a second group header and the remainder of the fields in the detail section.
any help would be greatly appreciated!
|
|
|
|
|
hello,
I am trying to learn how to call a subroutine at the beginning of a program, before anyone has to click on anything. I am writing a real simple unit conversion program, and I wanted to display this menu inside a picture box:
pic_unitDisplay.Print "1. inch", "2. fathom", "3. foot"
pic_unitDisplay.Print "4. furlong", "5. kilometer", "6. meter"
pic_unitDisplay.Print "7. fathom", "8. rod", "9. yard"
(oh yeah I am doingthis in VB 6)
So I placed that in a subroutine called unitDisplay. If I call subroutine on any of the click, like a command button or anything, it'll pop up like I want. BUT I want it to pop up first, right at the beginning of the program. How do I call a subroutine right at the beginning of program execution?
Thanks
Nick
|
|
|
|
|
hi..
write your code in the Form_Load() event..
make sure that AutoRedraw property of the picture control is set to true
|
|
|
|
|
add a Sub Main module. then change your project preferences
sub Main
frmConevert.show vbModal,me
end sub
----
sub Form_Load
' setup
pic_unitDisplay.Print "1. inch", "2. fathom", "3. foot"
pic_unitDisplay.Print "4. furlong", "5. kilometer", "6. meter"
pic_unitDisplay.Print "7. fathom", "8. rod", "9. yard"
end sub
|
|
|
|
|
I am trying to generate a report in VB. What the report is generating is the individual product turnover in a given period (ie between 2 date values,obtained from 2textboxes), and grouped by product type. To do this, i have created a data environment, set up a connection and added a command. using the SQL builder, i have tried to create a SQL statement to satisfy the data i am trying to articulate. all the examples i have seen accept parametres in the select clause but not the Where so i dont know the syntax for what i am trying to achieve. here is the SQL:
SELECT Product.Description, COUNT(OrderDetail.Quantity) AS Quantity, SUM(OrderDetail.Price) AS Price, ProductType.Description AS TypeDescription FROM Product, ProductType, OrderGenerate, OrderDetail WHERE Product .TypeCode = ProductType.TypeCode AND (OrderGenerate.OrderDate) BETWEEN = ? AND = ?
and my code under the command button to generate the report is:
deProductTurnover.ProductTurnover_Grouping dStart, dFinish
rptProductTurnover.Show
i have defined the parametres and the appropriate groups aswell.
what am i doing wrong, what is the correct SQL statement? the error being returned is: "unabled to determine the parameter information for the parameters. Use the parameters Tab to specify appropriate info". any help would be greatly appreciated!
|
|
|
|
|
Hi all,
I've created a data carrier class, with some basic public properties. I've also created a strong typed collection for that class like this:
<Serializable()> _
Public Class CustomerCollection
Inherits CollectionBase
Public Default Property Item(index As Integer) As Customer
Return MyBase.InnerList.Item(index)
End Property
'Functionality to fill collection with customers...
End Class
This CustomerCollection-class is exposed by a webservice, like this:
<WebMethod()> Public Function GetCustomers() As CustomerCollection
Dim customers As New CustomerCollection
Customers.Fill
Return customers
End Function
The webservice works fine, I can reference it in another project and consume the data. But when I try to bind the returned array of Customers to a DataGrid, the DataGrid does not show the columns...
Dim ws As New localhost.CustomerEngine
DataGrid1.DataSource = ws.GetCustomers
I can see how many rows/items the collection/array has, but there is not a single column that shows a property of the Customer class.
I've searched for a solution for this problem, but I haven't found one. So I hope someone can help me with this one.
Thanx,
Jan
|
|
|
|
|
Hi all
I've created a solution for this problem, for who is intrested, you can find it here: http://www.codeproject.com/useritems/LeaditWebServiceWrapper.asp.
Jan
|
|
|
|
|
I am a C++ programmer just starting work on a VB program (for the first time), and could find a string format similar to printf or CString::Format(). Does VB 6.0 (not VB.NET) support this? If not, is the only other way concatenating strings? For example (VC++ CString::Format()):
strTemp.Format( "Visual Basic %d", 6 );
This is a simple example, but if I had a lengthy SQL statement, this would be handy...
Thanks in advance!
Derek
|
|
|
|
|
I'm beginner in VB too..
that's what I found in MFC. Hope it is useful.
<br />
Dim MyTime, MyDate, MyStr<br />
MyTime = #17:04:23#<br />
MyDate = #January 27, 1993#<br />
<br />
' Returns current system time in the system-defined long time format.<br />
MyStr = Format(Time, "Long Time")<br />
<br />
' Returns current system date in the system-defined long date format.<br />
MyStr = Format(Date, "Long Date")<br />
<br />
MyStr = Format(MyTime, "h:m:s") ' Returns "17:4:23".<br />
MyStr = Format(MyTime, "hh:mm:ss AMPM") ' Returns "05:04:23 PM".<br />
MyStr = Format(MyDate, "dddd, mmm d yyyy") ' Returns "Wednesday,<br />
' Jan 27 1993".<br />
' If format is not supplied, a string is returned.<br />
MyStr = Format(23) ' Returns "23".<br />
<br />
' User-defined formats.<br />
MyStr = Format(5459.4, "##,##0.00") ' Returns "5,459.40".<br />
MyStr = Format(334.9, "###0.00") ' Returns "334.90".<br />
MyStr = Format(5, "0.00%") ' Returns "500.00%".<br />
MyStr = Format("HELLO", "<") ' Returns "hello".<br />
MyStr = Format("This is it", ">") ' Returns "THIS IS IT".<br />
<br />
|
|
|
|
|
Thanks - unfortunately I was looking for something like:
' Note: Contrived example...<br />
Dim fmt As String<br />
Dim sql As String<br />
<br />
'Imaginary Format Function<br />
fmt = "SELECT FirstName from Employee WHERE Zip=%d and AreaCode=%d"<br />
sql = Format(fmt, 04401, 207)
Does this imaginary function exist natively in VB 6.0 somewhere?
|
|
|
|
|
I work c++ and vb to and i can tell you that those languages have nothing common.
For example with the "printf" function you display something on the screen
In vb you need to crate a label or text for example and the assign the value you want to your object.
eg.
'Declare your variables
Dim fmt As String
Dim sql As String
Dim InputStr As String
' %d is an input from the user right? So here you have to do this using a text box.
'when the user types the value he wants in the text box you get it and work with it
' eg
Let say user gives the value "18542" for are code in the text box
InputStr = text1.text
' Now the InputStr Variable has the value "18542"
fmt = "Select Firstname from Employee where zip = " & InputStr
' This means that the statement is Select Firstname from Employee where zip = 18542
' Those results don't expect to get them anywhere in the screen
' Create a Label or text (label for example and connect it to your data control
'Refresh your data control after assigning your new SQL Statement and you will get the result in your label
I hope this will help you
Mike Economou
|
|
|
|
|
Hi!
I would like to know how can i, pressing the form's minimize button, run a function of mine that makes the aplication to run in the system tray, this last part is done, i just can't find anything that allows me to catch the minimize button event.
Can anyone help me?
Thank you for your time
|
|
|
|
|
Try this:
Private Sub Test(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
MsgBox("Worked")
End If
End Sub
Let me know if this helps.
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
animation mechanics in SVG
|
|
|
|
|
Try this:
Private Sub Form1_Deactivate(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Deactivate
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
End If
End Sub
Or if you already have a function of your own then simply replace the Me.Hide() part and you are in business.
Good Luck
|
|
|
|
|
Hi all!
how can I convert the number ( 42 ) to A
I mean in ASCII code 42 is an "A" so If I have number 42 how can I convert it into "A" in VB.
I know that in C++ I can used IsAlpha().
Thanks
|
|
|
|
|
Hi Win
Here's the VB.NET code (hope this is the VB ver. you wanted):
Imports System.Text.Encoding
Imports Microsoft.VisualBasic
Module Module1
Sub Main()
Dim i As Integer = AscW("A")
Console.WriteLine(i.ToString())
Dim c As Char = ChrW(i)
Console.WriteLine(c.ToString())
Console.ReadLine()
End Sub
End Module
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
animation mechanics in SVG
|
|
|
|
|
Thanks Simon. That's exactly what I want.
Thanks millions....
|
|
|
|
|
Cool, glad it helped.
The wierd thing is that MS/other seem to recommend not using the Microsoft.VisualBasic namespace as (I think) it uses interop in the background.
Perhaps keep this code in a single function so it won't be too much of a sweat to change later, if necessary.
I'll keep a look out for an alternative.
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
animation mechanics in SVG
|
|
|
|
|
Hmmm.....isn't easier to use the Chr function??
Chr(65) = "A"
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
|
|
|
|