|
Works, but you don't need the loops in the code at all. You just need to call GetAsyncKeyState with a parameter of 27 and then check it again with the same parameter to read that key and that key only.
Now, GetAsyncKeyState will miss keys because if another app calls GetAsyncKeyState , it will receive the keypressed signal, not your app. The status of the keyboard is not kept application specific, but rather system-wide. ANY call to GetAsyncKeyState will reset the key-pressed flag, not just calls from your app. If you call GetAsyncKeyState , then another app calls it, that app will get the message that ESC was pressed and reset the flag. Now, on the timer tick, your app calls GetAsyncKeyState again, and gues what, since the flag was reset, you'll never know that the key was pressed...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am having problem in Previewing my reports. Same Code is running fine if I dont use my main form as mdi. I will appreciat if someone can help me I search all over the net but couldnt find anything like this. I have my main form as mdi , from menu I am running a form then In form I have a button for preview the report , the preview window is coming up the and error is popping up "An unhandled exception has occurred .... Object reference not set to an instance of an object.
In details: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.PrintPreviewControl.CalculatePageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
My code is very simple
Dim dlg As New PrintPreviewDialog
dlg.Document = mDoc
dlg.WindowState = FormWindowState.Maximized
dlg.ShowDialog()
If I use a non mdi form as main form in my application everything becomes fine without any modification.
|
|
|
|
|
|
I need some help getting started. I need to connect a switch to a com port and in my code trigger an event when the switch state changes. Not to difficult but what pins do I use on the port and how do I insure I will not be hurting the pc. Thanks for your input.
Mike
|
|
|
|
|
The parallel port would be a much better choice for this. You can start by checking out the enormous list of resources at Lakeview Research[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a section of code (shown below) which reads an XML file into a Dataset. The XML file looks like this:
- <NewDataSet>
- <Employees>
<SUPR>Jane Moneypenny</SUPR>
<DEPT>Accounting</DEPT>
<EMP>James Bond</EMP>
<TITL>Accountant</TITL>
<DEADL>11/15/04</DEADL>
<HOURS>24.00</HOURS>
</Employees>
</NewDataSet>
The following code produces a crystal report which I export to a pdf file. Only one row of data is per page. Basically it is a letter that goes to the supervisor per page. My client has asked if I can split the document up where it breaks into individual pdf documents per row or maybe even per supervisor. If it breaks per supervisor, the pdf file may contain multiple employees with a page per employee.
I'm new to VB.NET and not sure how to accomplish this. I've spent two days trying to come up with a for next loop that might work without luck. I'm an old COBOL programmer still trying to get familiar with object oriented programming.
Does anyone have suggestions and/or some sample code to help figure out this task.
I appreciate any help!!
Private Sub step3()
Dim ds As New DataSet
Dim fs As New System.IO.FileStream("c:\test.xml", System.IO.FileMode.Open)
ds.ReadXml(fs)
ds.Tables(0).TableName = "Employees"
Dim xmlReport As New rptRenewalReminder 'Crystal Report
xmlReport.SetDataSource(ds)
Dim frmCrystal As New frmCrystalViewer
frmCrystal.CrystalViewer.ReportSource = xmlReport
frmCrystal.ShowDialog()
Dim myDiskFileDestinationOptions As New DiskFileDestinationOptions
Dim strAdobeRenewalLetter As String
strAdobeRenewalLetter = "test.pdf"
myDiskFileDestinationOptions.DiskFileName = strAdobeRenewalLetter
With xmlReport.ExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
xmlReport.Export()
MsgBox(strAdobeRenewalLetter & " has been saved")
End Sub
<b><i><font color="blue">Lost in the vast sea of .NET</font></i></b>
|
|
|
|
|
how can i link a sub report in the main report and pass data to both reports through dataset.Thanx in advance
|
|
|
|
|
i want to add a txt file to sql db using vb6.0 how i can do it
i used this code but failed why
CODE...............--->
Option Explicit
Dim mfso As New FileSystemObject
Dim fPath As File
Private machinename As String
Public Cmd As New ADODB.Command
Public CN As New ADODB.Connection
Public RS As New ADODB.Recordset
Private Sub Command4_Click()
Dim filePath, txtFilePath, test As String
Dim i, result As Integer
i = List1.ListIndex
Dim jj As String
Dim strContent As String
Dim txtmachinename, tableName As String
machinename = String(50, " ")
Call MachineSpecificInfo.GetComputerName(machinename, Len(machinename))
txtmachinename = Left(machinename, InStr(Trim(machinename), Chr(0)) - 1)
machinename = vbNullString
On Error Resume Next
CN.ConnectionString = "Provider='" & "SQLOLEDB.1" & "' ;User id='" & "sa" & "' ;password='" & "" & "' ;Persist Security info='" & "false" & "' ; Data Source='" & txtmachinename & "' ;Connect Timeout=0; Initial Catalog='" & "darpg" & "'"
CN.Open
RS.CursorType = adOpenDynamic
RS.LockType = adLockOptimistic
RS.CursorLocation = adUseClient
tableName = "pdbftsdata"
RS.Open "Select max(FTSIndex) from pdbftsdata", CN
Dim maxx As Integer
maxx = RS(0)
maxx = maxx + 1
result = InStr(1, List1.List(i), "_")
DocId = Left$(List1.List(i), result - 1)
DocId = 13
MsgBox DocId
'Set fPath = mfso.GetFile(txtFilePath)
Set fPath = mfso.GetFile("C:\Documents and Settings\mdabaan\Desktop\Last Project\TXTFolder\a.txt")
Set objTextStream = fPath.OpenAsTextStream(ForReading)
strContent = objTextStream.ReadAll
'result = Len(strContent)
Dim textShow As String
MsgBox strContent
textShow = Replace(strContent, vbCrLf, " ")
objTextStream.Close
MsgBox textShow
Dim ss As String
ss = textShow
RichTextBox1.Text = ss
MsgBox Len(ss)
CN.Execute "INSERT INTO pdbftsdata(Documentindex,data) values('" & DocId & "','" & ss & "')"
CN.Close
'------------
List1.RemoveItem (i)
'List2.RemoveItem (i)
' End If
'End If
End Sub
Thanks alot
Metal Man
|
|
|
|
|
hi, i wrote a code that open a txt file and then add it to sql db but nothing added i will put my code to see could any1 help me ASAP to solve my problem cause no thing added why??????
Code---->>>>
Option Explicit
Dim mfso As New FileSystemObject
Dim fPath As File
Private machinename As String
Public Cmd As New ADODB.Command
Public CN As New ADODB.Connection
Public RS As New ADODB.Recordset
Private Sub Command4_Click()
Dim filePath, txtFilePath, test As String
Dim i, result As Integer
i = List1.ListIndex
Dim jj As String
Dim strContent As String
Dim txtmachinename, tableName As String
machinename = String(50, " ")
Call MachineSpecificInfo.GetComputerName(machinename, Len(machinename))
txtmachinename = Left(machinename, InStr(Trim(machinename), Chr(0)) - 1)
machinename = vbNullString
On Error Resume Next
CN.ConnectionString = "Provider='" & "SQLOLEDB.1" & "' ;User id='" & "sa" & "' ;password='" & "" & "' ;Persist Security info='" & "false" & "' ; Data Source='" & txtmachinename & "' ;Connect Timeout=0; Initial Catalog='" & "darpg" & "'"
CN.Open
RS.CursorType = adOpenDynamic
RS.LockType = adLockOptimistic
RS.CursorLocation = adUseClient
tableName = "pdbftsdata"
RS.Open "Select max(FTSIndex) from pdbftsdata", CN
Dim maxx As Integer
maxx = RS(0)
maxx = maxx + 1
result = InStr(1, List1.List(i), "_")
DocId = Left$(List1.List(i), result - 1)
DocId = 13
MsgBox DocId
'Set fPath = mfso.GetFile(txtFilePath)
Set fPath = mfso.GetFile("C:\Documents and Settings\mdabaan\Desktop\Last Project\TXTFolder\a.txt")
Set objTextStream = fPath.OpenAsTextStream(ForReading)
strContent = objTextStream.ReadAll
'result = Len(strContent)
Dim textShow As String
MsgBox strContent
textShow = Replace(strContent, vbCrLf, " ")
objTextStream.Close
MsgBox textShow
Dim ss As String
ss = textShow
RichTextBox1.Text = ss
MsgBox Len(ss)
CN.Execute "INSERT INTO pdbftsdata(Documentindex,data) values('" & DocId & "','" & ss & "')"
CN.Close
'------------
List1.RemoveItem (i)
'List2.RemoveItem (i)
' End If
'End If
End Sub
Thanks alot
Metal Man
|
|
|
|
|
I'm not even ogin to attempt to compile this. We've said it here on the board dozens of times.
NEVER use string concantenation to put together an SQL statement! There is absolutely no reason to do it.
Now, the reason your SQL is failing is probably because there is an ' character in your text file. That's all that is required to destroy your SQL statement.
The fix will be to use parameterized queries. This is virtually the only method you can use to guarantee that the contents of the text file will get processed properly and not screw up your SQL statement.
See Calling a Stored Procedure with a Command[^] on MSDN for an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi man thanks for ur time, but i have another solution which is i will replace all the enter in the txt file to space cause db doesnt accept ok, now i will split the txt to sparate lines depend on ' charachter if t appear, ok so i will first add a apce to the field then i will update it, i used the command---->
CN.Execute "UPDATE pdbftsdata SET Data = '" & strToAdd & "' Where = DocumentIndex= 13"
but it doesnt executed could u tell me why, and whats th coorect update line have to be, thanks alot
Thanks alot
Metal Man
|
|
|
|
|
hi man again, i replaced all the ' character with a special char, and then added all the txt file it was added correctly, i want to make a procedure that will replace all the ' char in this field and return it to ' char how i can do it
Thanks alot
Metal Man
|
|
|
|
|
I already told you what you have to do. Stop using the string concantentation method and start using the ADODB.Parameter objects to build a parameterized query that will handle all of your problems for you, automatically. You already have an example of it and if you need another one, check out Command Object Parameters[^].
If you don't do this, you're wasting your time...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ok man i understand, but i want to know u that i program on asp.net i never used vb6.0 b4, but i use it know cause manager of me asked me to do it on vb6.0 ok, i wanna ask u how i can move the control bocx to the left cause am programming an arabic project, pls be patient with me ok man
Thanks alot
Metal Man
|
|
|
|
|
I can't find any instance of it ever being done in VB6. It can be done in VB.NET because the way Windows Forms works is very different than in VB6.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi, ok could u tell me how i can change a field type of a database tablde in vb6.0 progrma, and if i change it every time i lood the program to the same type will it destroyed,
and i want to know what is the best field type for storing txt file in sql db
Thanks alot
Metal Man
|
|
|
|
|
Mohammad Bassam Daba`an wrote:
ok could u tell me how i can change a field type of a database tablde in vb6.0 progrma
No, I can't. I've never had cause to do this. Normally, you would never do this in your application, unless your application is a database management system. If you change the type of the column, you will most likely destroy the data in that column.
Mohammad Bassam Daba`an wrote:
if i change it every time i lood the program to the same type will it destroyed
?????????????? I take it your asking if you make the change to the database, will that change persist between sessions of your application. YES! Any change you make to the database is permanent and will not be undone when your application quits.
Mohammad Bassam Daba`an wrote:
i want to know what is the best field type for storing txt file in sql db
If you have text files of varying length and unknown content, then the best field type to use is ntext .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Overall goal:
Allow web visitors to select frames from a streamed WMV video, then receive the selected frames via email in JPG format. No controls or specific software can be installed on or required of the client computer other than Windows Media Player 9 and IE 6.
Currently Selected Approach:
Server is IIS 5.0.
Using client-side scripting, store the user's selected frames using the Windows Media Player object's timestamp from the player.controls.currentPosition property. Then send these timestamps to an ASP "processing page" to pull the frames from the video and email them to the user. A few 3rd party controls (Server-Side ActiveX) have been found which provide the functionality to pull frames from a WMV and save them as JPEGs.
Obstacle:
None of the 3rd party controls provide an interface (COM) which is accessible to an ASP page.
Proposed Solution:
Create a COM wrapper to provide the necessary interface.
Obstacle for Proposed Solution:
Testing has shown that a VB.NET Class Library cannot be called from an ASP page unless it is registered in the Global Application Cache(GAC) using gacutil /i , which requires the Class Library to be strong-named.
The VB.NET compiler will not compile a strong-named Class Library with a reference that is not strong-named. None of the 3rd party Server-Side Controls I've found are strong-named.
-----
I need to know how to make the compiler create a strong-named Library with a reference that is not strong-named, or how to get my ASP page to create an object (Server.Createobject(progID) ) from a Library that is only listed in the Registry (regasm /u ) and NOT in the GAC.
I have tried creating a wrapper Library (not strong-named) and registering it with regasm /u , and then creating it in an ASP page Server.Createobject(progID) , but the ASP Parser gives me an error: 0x80070002 with no description.
This is the same error # as when trying to CreateObject with an invalid progID, however, in that case (invalid ID), there is a description stating that you have tried to use an invalid ID.
What I wouldn't give for a VB6 compiler. . .
I hope the information I gave isn't TOO detailed, but I know details make things easier for people to respond.
I am running out of ideas. If anyone has run into a similar problem or knows what I am doing wrong (or not doing), please help.
Alternatively, if anyone has another idea for a solution to the overall problem (way up there at the top of the post), that, too, would be greatly useful.
Many thanks in advance,
Mike the Red
|
|
|
|
|
For the 3rd party controls, you can manually create strong-named interop assemblies. You do this by using aximp (for ocx controls) or tlbimp (for dlls) with the /keyfile parameter.
my blog
|
|
|
|
|
Thank you, Mr. Campbell, it compiles like a charm, now.
I ran into another problem, though, and was hoping you or someone else might give me a hand with it.
The ASP Parser is giving me an error
Error Type:
[ProjectNamespace] (0x80070005)
Access is denied.
/test.asp, line 7
I added explicit Read & Execute access for IUSR_computerName to my wrapper DLL, the strong-named copy of the 3rd party DLL used by my wrapper, and to the MSVBVM60.DLL. This resulted in no change in the error message, however.
I also re-compiled one of my test Class Libraries (which makes no reference to other DLLs) and am able to access its namespace without error. This leads me to believe it has something to do with the wrapper's access to the 3rd party DLL, but I'm not sure.
Thanks in advance for any responses,
Mike the Red
|
|
|
|
|
Hi, working on some VB6 code and have a question about API calls.
How do I find the proper formating for the "Declare Function" statements that is needed for dll calls in VB. I have used the API Viewer for some functions, variables and constants but for other there is no info in the database file.
One example, the function SetupDiGetClassDevs in setupapi.dll is documented in msdn as
HDEVINFO SetupDiGetClassDevs(
const GUID* ClassGuid,
PCTSTR Enumerator,
HWND hwndParent, DWORD Flags);
but to use this is vb I need to first define the types used and the the actual function, would be something like, if I understand it correct:
Private Declare Function SetupDiGetClassDevs Lib "setupapi.dll" Alias "SetupDiGetClassDevsA" _
(ByRef ClassGuid As GUID, ByRef Enumerator As Long, ByRef hwndParent As Long, ByVal Flags) As Long
Then for the Flags parameter ther is several constants define DIGCF_ALLCLASSES, DIGCF_DEVICEINTERFACE, DIGCF_PRESENT, DIGCF_PROFILE and for those I cant find the actual values that I need for redefining them in VB.
The same goes for a lot of other API calls that I would like to use. Is there any update datafile for the API Viewer to dovnload or any other sorce of info on how to do, or is it all up to digg into the include files and stuff to track down the info?
regards Me
|
|
|
|
|
here:
http://www.mentalis.org/
|
|
|
|
|
I am having problem in assigning rights to a windows user.Acctually my program abnormally terminates when it executes the API function " LookupAccountName " .So if any one can show me an example to use this function and what could be the cause?
Prepare yourseld for the life after death.God bless you.
|
|
|
|
|
Has anybody tried implementing GLOBAL cbt hooks in .net?
I keep getting a .net framework runtime error as soon as the hook is activated...however it works fine LOCALY...
I just keep getting the command prompt screen with a "Runtime" error message i hate it!
|
|
|
|
|
if somthing else has it hooked already it will error out if you have it set to global.
what hook are you trying to use?
|
|
|
|
|