|
We need to know on what line the exception occured, otherwise we really can't tell you with any accuracy what you did wrong.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This is in form.
<br />
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click<br />
Dim sp As Course.theClass.myApp<br />
sp.printOut(Me.InputText.Text()) ' here the error pointing to.<br />
End Sub<br />
the myApp class
<br />
Option Strict On<br />
Option Explicit On <br />
<br />
Imports System.Windows.Forms<br />
<br />
' The class module is enclose in a namespace named CountingStatement. <br />
' The root namespace was set to Course using the Project Properties dialog box. <br />
Namespace theClass<br />
<br />
' The class is named StringProcessor.<br />
Public Class myApp<br />
Public Sub printOut(ByVal theText As String)<br />
'get the total number of characters,#of Words, #of paragraph, and # of sentence in that paragraph. <br />
MsgBox (theText)<br />
End Sub<br />
End Class<br />
End Namespace<br />
It is not as easy as c++. I dont know how to call the class function from the other class in VB.net.
Thank you
|
|
|
|
|
The problem is that you delcared sp as Course.theClass.myApp, but you never instantiated it. It should be:
Dim sp As New Course.theClass.MyApp
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you... it works now.
|
|
|
|
|
does anyone know somewhere when they have written code to verify what users are signed onto a program.
for example. If i only want 10 users logged in at once but 100 possible users in the program. Each instance will be running on a diff pc and i cant figure out how to validate what users are logged on and limit the logged on users to 10
Vince
|
|
|
|
|
Your application would need its own licensing server. Something you would have to write from scratch and into your application. Your app would ask the user for an username and password, login into the license server, check out a license on a lease (timed) basis, say 30 minutes, and when the app quits, check with the license server to return the license. You would also have to write into the license server some kind of timeout where if the server did not hear from the client, the license would be returned to the license pool. The clients would also have to check in with the server occasionally to renew their leases. This is necessary for the simple reason an application could hang and the license would be checked out without ever being checked back in properly. Not too hard to write, but, like I said, you'd have to write it from scratch.
Oh! Then you would need a management tool to administer the license server too...
Or buy the components from a 3rd party, of which I have no idea who sells something like this...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, Building a game for my school final project and I have enought programming skill to know loops, if's, and a bit of other things.
I was wondering what is the way a person with my programming abilities would go about adding sound and playing it within VB. It would be appreciated if soeone could help me out. Otherwise I have a soundless, boring game.
|
|
|
|
|
Well, the simple way to do it is buy calling into the Win32 API. Something, I take it, your class never covered...
But, anyway, you would Declare the call into the API like this:
Private Declare Function Beep Lib "kernel32" Alias "Beep" _
(ByVal dwFrequency As Long, ByVal dwDuration As Long) As Long
Then, when you want to play a sound:
Beep 5000, 250
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks alot Dave, now I will have the rockinest game ever!
That is very, Very, VERY, VERY!, cool. Thanks alot..again.
(amended after school)
Ok uh..instead of the beeps...because my computer teacher hates me now because the room was full of...beeping, how would I play a .wav, like "sound.wav" within VB? Then with actual sound it would benifit me very much.
|
|
|
|
|
how can i delete this chater "
from a string, like this one
"c:\windows
<br />
'sample code<br />
<br />
cmdline$ = "c:\windows\notepad.exe" <br />
path = cmdline$<br />
WorkingDirectory = Mid(path, 1, InStrRev(path, "\") - 1)<br />
MsgBox WorkingDirectory<br />
jeroen
|
|
|
|
|
Replace(Command$, Chr$(34), "")
Chr$(34) could be "\"" i could be wrong.
Shin
|
|
|
|
|
You might want to check into using the Path class to return full paths to files and directories:
cmdLine$ = chr$(34) & "C:\Windows\notepad.exe" & chr$(34) ' "C:\Windows\notepad.exe"
WorkingDirectory = Path.GetFullPath(cmdLine$) ' will be C:\Windows\notepad.exe
WorkingDriectory = Path.GetPathRoot(WorkingDirectory) ' Should be C:\Windows
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Going to use it for CreateProcessA
<br />
Public Function ExecuteAndWait(cmdline$)<br />
On Error GoTo Error<br />
<br />
Dim NameOfProc As PROCESS_INFORMATION<br />
Dim NameStart As STARTUPINFO<br />
Dim x As Long<br />
Dim WorkingDirectory As String<br />
Dim Path As String<br />
<br />
Path = cmdline$<br />
WorkingDirectory = Mid(Path, 1, InStrRev(Path, "\") - 1)<br />
<br />
MsgBox WorkingDirectory<br />
GoTo Quit<br />
NameStart.cb = Len(NameStart)<br />
x = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, WorkingDirectory, NameStart, NameOfProc)<br />
x = WaitForSingleObject(NameOfProc.hProcess, INFINITE)<br />
x = CloseHandle(NameOfProc.hProcess)<br />
<br />
Exit Function<br />
Error: ' Error handling<br />
MsgBox "Run-Time Error number " & Err.Number & vbCrLf & Err.Description, vbOKOnly + vbCritical, "CreateProcess"<br />
GoTo Quit<br />
Quit:<br />
End Function<br />
i cant find declare sampels with api text viewer
<br />
GetFullPath declared like this : ?<br />
<br />
Public Declare Function GetFullPath Lib "kernel32" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long<br />
<br />
<br />
GetPathRoot declared like this : ?<br />
<br />
Private Declare Function GetPathRoot Lib "gdi32.dll" (ByVal hdc As Long, ByRef lpPoint As POINTAPI, ByRef lpTypes As Byte, ByVal nSize As Long) As Long<br />
<br />
<br />
thanks for helping
jeroen
|
|
|
|
|
Sorry, the examples I gave were for VB.NET. There are no equivilents in VB6...
You would have to use the FileSystemObject to get the same functionality.
See this[^] for the docs on the FSO. Oh! You'll also have to set a reference to the Windows Scripting Runtime.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
no need use the FileSystemObject to get the same result
<br />
Dim WorkingDirectory As String<br />
Dim Path As String<br />
Dim Path1 As String<br />
<br />
Path = cmdline$<br />
Path1 = Right(Path, Len(Path) - 1)<br />
WorkingDirectory = Mid(Path1, 1, InStrRev(Path1, "\") - 1)<br />
msgbox WorkingDirectory<br />
Thanks for help
Greets Jeroen
|
|
|
|
|
True, but your code isn't portable and can't cope with paths that start with periods (relative path names).
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I can add a new column only at the last column in my database table with
<br />
strSQL = "ALTER TABLE Invoice ADD COLUMN " & taxName.Text & " currency"<br />
cmd.CommandText = strSQL<br />
What if I want to insert (add) new column at the desired place (let say I have Col1, Col2, Col3, Col4, now I want to insert new column Col_N after Col2)? Anyone knows how to do it?
Thanks to all suggestions,
|
|
|
|
|
Although the documentation on ALTER TABLE says it doesn't support what you want to do, you might want to try adding a BEFORE fieldname to the statement.
ALTER TABLE Invoice ADD COLUMN " & taxName.Text & " currency BEFORE <fieldname>
If that doesn't work, and I don't think it will you could get around this by following these steps:
1. Rename that table.
2. Create a new table with the same fields as the original with all the sametriggers, constraints, ...
But when you create the columns, create them in order and create the new column when appropriate.
3. Copy the data to the new table.
4. Delete the old table.
This is the approximate procedure that the Enterprise Manager uses to do the same thing you are. This is so you can make a bunch of changes all at once. The EM won't commit the changes and create the new table until after you hit OK.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
1. I tried the ALTER TABLE Invoice ADD COLUMN " & taxName.Text & " currency BEFORE <fieldname> ... but I got error on it, might be it not good for MS Access .mdb
2. I will try more but if all fail, I will try your suggested around way
Thanks for help
|
|
|
|
|
well, as far as DB stuff goes, theres really no reason to have them in a certain order. Just pull the information out of the DB when you query it in the order that you want. Other than that i'm not really sure how to add a column in a certain place. DB != Excel Spreadsheets :-P
|
|
|
|
|
i have a project where my application must catch all that a user is doing on the computer when a specified exe file is running.
exemple: Each time "calc.exe" is running, my application must run into background and an put in a file all that the user is doing.
can you help me please.
|
|
|
|
|
Don't ask much, do you? What do you mean by "everything"? What do you want to log? The names of the buttons this person clicks on? Every keystroke the user types? Are you planning on playing this back so you can see everything the user did?
You're going to have to use a couple of system wide hooks to accomplish something like this. Read up on the CBT, JOURNALRECORD and JOURNALPLAYBACK hooks here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Good morning.
Maybe i asking for too much. Let's have it like to know every key the user types. Then how can i proceed.
Thank you for your link, but the process is difficult, and they don't have exemple for vb code use.
I don't know what you can do for me.
|
|
|
|
|
It doesn't get much easier. You're still hooking the system to catch the keystrokes. In VB6, this is very difficult. It gets easier in VB.NET, but you'll still have to either write a keyboard hook or a MessageFilter that you register with Application.AddMessageFilter.
There are example of this being done in VB.NET, but they are not specific to hooking the keyboard and you still need an in depth knowledge of Windows internals to udnerstand whats going on.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have replaced most of the for loops with Array.Copy to mimic the functions of the dll call. But this did not have the speed increase that i was looking for. still same processor time at 100 for 3 seconds. I have also tried a few things like encrypting a 1.4 meg file with the 6.0 version of the blowfish program and it takes seconds. I try with the .Net conversion and it take around 10 minutes to do the same thing. Throughout the conversion of this 6.0 project i have had to make many sub procedures to mimic the function of this dll. I believe the extensive use of this procedures are what is slowing me down.
The function is pretty cool if i work in .net. I need an outside call to do some of the work for me because my app is straining a little to hard. I need something that does the same thing that the rtlMoveMemory does when you send it something like this
<br />
Public Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)<br />
<br />
Dim LongValue as Long = 1415936116<br />
Dim BB() as Byte<br />
CopyMemory( BB(0), LongValue , 4)<br />
and what this does is turn this number into binary
looks like this BB(0) = 116 : BB(1) = 120 : BB(2) = 101 : BB(3) = 84 in the byte array. I also need a function that does this process in reverse. I had to mimic this with extensive for loops to check each bit. If i could find an outside call to do this same thing. I also found out if the value is greater than 2147483648 which is 2 ^ 31 and is also the highest value bit in a 32 bit number. the function causes the value to go negative and subtract any other amount that the bits equal preceding that last bit.
If there is any outside funtion can be used that would speed up my code. I really need to know because with the .net conversion that i am using now. If i didnt have a 6000 RPM Fan i would cook my P4 2.8 GHZ Processor. Oh yes a article on application throttling would be great too if anyone knows where i could read one.
|
|
|
|
|