|
Upper case is : Ucase$(string)
Access to Excel: Add a reference to Microsoft Excel Object.
Public Class clsXL
Dim xl as Excel.Application
Private Sub Class_Initialize()
On Error Resume Next
Set xl = CreateObject("Excel.Application")
xl.DisplayAlerts = False
End Sub
Private Sub Class_Terminate()
' If IsLaunched Then xl.Application.Quit
Set xl = Nothing
End Sub
Public Function Export(rs As Recordset) as Boolean
dim ws as Worksheet
dim c as integer 'column
dim i as integer 'row counter
If Not xl Is Nothing Then
xl.Workbooks.Add
Set ws = xl.ActiveSheet
'Set the column headers
'....
'Now loop through the rows & columns of the recordset to add the values
i = 2
do while not rs.eof
for c = rs.fields.count
w.Cells(i, c) = .Fields(c).Value & vbNullString
i = i + 1
rs.movenext
next
loop
'Format work sheet further
'now print preview the sheet
xl.DisplayAlerts = False
xl.Visible = True
xl.ActiveWorkbook.Worksheets.PrintOut , , , True
xl.Visible = False
xl.Application.Quit
end if
End Function
By doing this he can do what ever he wants with the excel spreadsheet Save, Sent To or Print.
Hope this helps.
Michael
|
|
|
|
|
I want the text that we key in in the vb form must in Uppercase.What is the method's?Help....................help............
Hi, i have create a program using VB6.The purpose of this program are for sales department person key in the data and then review by manager.Now, my problem is manager want me to create a command button to export the data from microsoft access to excel.What is the command button code and the step? Another Question,this program must set up in the office and all the staff can see and use this program at their own PC's!Thank for ur help!
|
|
|
|
|
hint :
use SetWindowLong API passing the window handle of the text box and ES_UPPERCASE
|
|
|
|
|
Why not just do it the simple way:
in the keydown event just do a .toupper for the char and handle the event.
|
|
|
|
|
Hi
Which property shud i set to make button a default button, so that when it is clicked the event fires automatically.
Thanks
Tasnim
|
|
|
|
|
I believe what you are asking is which property sets a button to the button that is the default action for a form, such that press "Enter" causes the click event of that button.
That property is the AcceptButton property of the Form.
|
|
|
|
|
i am trying to open the default email client with attachment.
i have successfully opened the default client, but i am not able to have it with attachment.
How can i do this ?
Looking for Help.
Regards,
Asim
|
|
|
|
|
as topic, anyone can provide some codes that enable a scroll bar to a picturebox when the picture expand?
|
|
|
|
|
Drop 2 PictureBoxes on your form, so that Picture1 is Picture2's Container. Drop horizontal and vertical ScrollBar controls on proper positions around Picture1. Set Picture1.AutoSize = False and Picture2.AutoSize = True. As you load picture(s) into Picture2, execute the following code:
If Picture2.Width > Picture1.Width Then
ScrollBarH.Enabled = True
Else
ScrollBarH.Enabled = False
End If
If Picture2.Height > Picture1.Height Then
ScrollBarV.Enabled = True
Else
ScrollBarV.Enabled = False
End If
Hope, it helps.
|
|
|
|
|
In my previous posting I forgot to mention that you control the position of Picture2 relative to Picture1 (which is a Container, remember?) with your scrollbars. The code to do that seems trivial enough: the horizontal scrollbar has to increment/decrement the Picture.Left, while the vertical one controls Picture2.Top properties.
|
|
|
|
|
Okay, here's the deal. Let's just say I have a variable, amtChange, which is a single floating point number. Let's say that it's 1.23 in this example. If I subtract amtDol, which is an integer with a value of 1, I end up with .2299995 as a difference. I find that this happens often.
How can I prevent and/or fix this? Oh, here's my code:
Private amtOwed, amtPaid, amtChange As Single<br />
Private amtDol, amtQuar, amtDime, amtNick, amtPen As Integer<br />
<br />
***<br />
<br />
amtOwed = Val(txtOwed.Text)<br />
amtPaid = Val(txtPaid.Text)<br />
amtChange = amtPaid - amtOwed<br />
amtDol = Int(amtChange)<br />
amtChange = amtChange - amtDol<br />
MsgBox(amtChange)<br />
And the Message Box gives me .2299995!
|
|
|
|
|
i'm not expert in this but try to change the data type into double
|
|
|
|
|
Hi,
You can try this.
Define all the variables as double or type cast it into double and then subtract it. Take the
result into a variable which is double.
Tasnim
|
|
|
|
|
As a matter of fact, it turns out the Decimal variable type doesn't generate ambiguous errors. Thanks for the input, though. I really appreciate it!
|
|
|
|
|
For starters, I am coming from a C/C++ background and I am trying to format a string with String.Format() but the options are somewhat different than that of the conventional printf and its derivatives.
Essentially what I want to have happen is I want to print out a numeric value in currency format but I want the number of spaces "before" the decimal place to be fixed. For instance, in the following example I show what I want the output to look like:
WHAT I WANT!
Name: Amount Due:
Jack Rolley $1,234.56
Jane Polley $ 843.76
WHAT I HAVE BEEN GETTING!
Name: Amount Due:
Jack Rolley $1,234.56
Jane Polley $843.76
I have tried using a variety of option with the String.Format() method and I can't seem to find a way to get what I want. Is there a common method (option) that I can use to get the hanging dollar sign?
I am using Visual Studio .NET at the student labs here at my university. Any insight into the string formatting issue would be greatly appreciated.
Thanks in advance,
Luke Martell
Kelsen_@hotmail.com
|
|
|
|
|
Hello Luke,
iv checked out this problem and here is exactly what you want. hope it helps.
Module Module1
Sub Main()
Dim amtDue(1) As Double
Dim myString(1) As String
amtDue(0) = 1234.56
amtDue(1) = 843.76
myString(0) = Format(amtDue(0), "n")
myString(1) = Format(amtDue(1), "n")
Console.WriteLine("$" & myString(0).PadLeft(8, " "))
Console.WriteLine("$" & myString(1).PadLeft(8, " "))
Console.ReadLine()
End Sub
End Module
this will display:
$1,234.56
$ 843.76
Jordan.
III
|
|
|
|
|
me again
Hmm..
here is a much more portable way to implement this code, using a function i made:
Module Module1
Sub Main()
Dim amtDue(1) As Double
amtDue(0) = 1234.56
amtDue(1) = 843.76
Console.WriteLine(PadAmt(amtDue(0)))
Console.WriteLine(PadAmt(amtDue(1)))
Console.ReadLine()
End Sub
Function PadAmt(ByVal amt As Double)
Dim mystring As String
mystring = Format(amt, "n")
Return "$" & mystring.PadLeft(8, " ")
End Function
End Module
again, this will display EXACTLY what you wanted, as in my other reply.
Please lemme know how it goes, thx.
Jordan.
III
|
|
|
|
|
hi,
I use VB6 and I want to freeze the rows on FlexGrid control. What could be the coding to achieve this.
|
|
|
|
|
Hi! Guys,
I am working with VB.NET 2002 on Windows XP.
I have a problem while working with parallel port. I have downloaded the dlls needed to communicate with parallel port on Windows XP.
But, the program doesn't seems to be working.
Isn't there any way to communicate with Parallel Port in Visual Studio.NET 2002 itself?
I am really feeling help-less while hardware interfacing comes in my way while working with VS.NET. If you guys know anything please let me know.
I am open for comments and suggestions.
Thanking you,
Ritesh.
|
|
|
|
|
There is nothing native to .NET. This is because all hardware, including the par/ser ports, is abstracted by the operating system and the processor running in protected mode. You absolutely must have those helper .DLL's to give you the ability to control the port directly.
You might want to look at these:
http://www.codeproject.com/csharp/csppleds.asp[^]
http://www.logix4u.net/[^]
RageInTheMachine9532
|
|
|
|
|
u hv the full admin right to ur NT system? if u dont hv the full admin right although u get all the DLL in sys directory, it's still helpless.
u must hv the full admin right to ur NT system, otherwise u need to find a crack program to crack it. But it's quite hard to find such one
|
|
|
|
|
Actually, the User's rights have nothing to do with the problem. You can be a normal (member of) User and have no issues with it at all.
The problem is the the INP and OUT instructions can only run in processor Ring0 (Kernel mode). Users programs are restricted to running in Ring3 (User mode). This means that if you try and execute and INP or OUT I/O port instruction, you'll get the infamous Application Exception Error saying something about executing a Priviledged Instruction. The user's rights to the system have nothing to do with this.
To get around the problem, you need a kernel mode (Ring0) device driver that can talk to the parallel port, and read and write data to it, and exposes some form of API that a user mode (Ring3) application can talk to. The kernel mode driver contains the INP and OUT instructions that are allowed to run in Ring0, but not Ring3.
Now, for a good example of how this is accomplished, see this site: http://www.logix4u.net/[^]
RageInTheMachine9532
|
|
|
|
|
Hi! Folks,
Below are the few queries that have arised in my mind after looking at the code in file "inpout32drv.cpp".
These are few of the hardcoded paths, that I have found,
1. C:\kernel_mode_driver_source\i386\hwinterface.pdb
2. nsf.\i386\hwinterface.sys
3. In CreateService function call you are using the hardcoded path "System32\\Drivers\\hwinterface.sys", but I have the "hwinterface.sys" file in the application directory only. Also, I have no such file in my "system32\drivers" directory.
First of all I don't know these paths stands for what?
Second thing is, Any of the above specified paths are not valid on my system.
Can these be a reason, that program is not working on my system?
I am sending the same at your e-mail box.
Thanking You,
Regards,
Ritesh.
|
|
|
|
|
Is it possible to have Scrollable tab. This property is not available in tab control, but is it any additional codding needs to be done.
Thanks
|
|
|
|
|
Yes, additional coding is required, and a lot of it.
|
|
|
|