|
I would like to know if there is a way to capture the event of another class??
|
|
|
|
|
Hi there
I don´t know exactly if you want this, but you can capture the event of the class with 2 ways:
First:
The declaration of the class is not in a function, it´s a global var. You can declare it like that:
Private WithEvents Client as ClientClass
And then you can set the handler of the event in a function, like that:
Private sub OnClientLogin (sender as object, e as eventArgs) handles Client.Login
Or you can set hte handler in the code:
Private sub SetClientEvents()
.....
addHandler Client.Login, addressof OnClientLogin
.....
end sub
Second:
If you have a class declared in the method, you can use addhandler
Private sub AddClient()
...
dim Client as ClientClass
...
addhandler Client.Login, addressof OnClientLogin
...
end sub
--------------
I think that is it what you want.
-----
LeandroAB
|
|
|
|
|
i made software which maintain a database of an institute.the institute have two department.i made adatabase in access(it has a column name department) and alredy connected it .it is fine and running in the software i have a form where i put A MSHFLEXGRID TO VIEW THE DATABASE.but now i am willing to filter the students accoording to the department and view them in two separate mshflex grid.(as the institute have two department).so please help me in this case by providing the code.thanks in advance.(***i am doing all this in vb6***)
|
|
|
|
|
Sorry, but we are not going to do your work for you. First, try to code it and when you get an error you cannot figure out then come back.
Blog link to be reinstated at a later date.
|
|
|
|
|
VB6 is crap, have you thought about using a real language instead ? Vb.NET is full of easy to use grids.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
Death to vb6! Take vb6 to the noose!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hello everybody. I have a file that is spaced with NULL instead of standard spaces. LIKE SO...
COMPANYNAME
C(NULL)O(NULL)M(NULL)P(NULL)A(NULL)N(NULL)Y(NULL)N(NULL)A(NULL)M(NULL)E(NULL)
I'm trying to make a utility that will remove or add the NULL spacing. First I started on the add function. Here's what I have
Private Sub btnOpenFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenFile.Click
Dim FileName As String = ""
With dlgOpenFile
.InitialDirectory = "C:\Stuff\Office2K3.SP2"
.Filter = "All Files|*.*"
End With
If (dlgOpenFile.ShowDialog = Windows.Forms.DialogResult.OK) Then
FileName = dlgOpenFile.FileName
'Dim sr As System.IO.StreamReader = Nothing
'sr = New System.IO.StreamReader(FileName)
'CurrentFileContents = sr.ReadToEnd
Dim fs As System.IO.FileStream = New System.IO.FileStream(FileName, IO.FileMode.Open, IO.FileAccess.Read)
Dim strLength As Integer = Convert.ToInt32(fs.Length)
Dim fileData As Byte() = New Byte(strLength) {}
fs.Read(fileData, 0, strLength)
fs.Flush()
fs.Close()
For Each x As Byte In fileData
txtOut.Text &= Convert.ToChar(x) & Chr(&H0)
Next x
'For Each x As Char In CurrentFileContents
'txtOut.Text &= x & vbNullChar
'Next x
'sr.Close()
End If
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
If (CurrentFileContents = "") Then
btnOpenFile_Click(sender, e)
End If
Dim null As String = vbNullChar
Dim newFile As String = ""
For Each x As Char In CurrentFileContents
newFile &= x & CStr(vbNullChar)
Next x
txtOut.Text = newFile
End Sub
I've tried 2 different ways. I tried using a streamreader and dumping the file into a string. Then iterate with a for each loop and append a NULL char after each value. This results in a string with 1 Char in it, the first one "C". If I remove the NULL char, the string will be complete.
The other method was using a byte array. This resulted in a dump but without the NULL bytes.
I've researched and there is alot of "NULL removal" or "MYSQL and NULL in DateField" but I see nothing on NULL padding. Any takers????
|
|
|
|
|
It looks like you have a unicode file, not an ascii one... I am sure, armed with this knowledge, google will help you out more than I can
|
|
|
|
|
The file is using a different encoding than ASCII, most likely Unicode. Change the StreamReader line to this to have it try and determine the encoding automatically:
Dim sr As New StreamReader(filename, True)
|
|
|
|
|
Hi everyone,
I'm using VB6.0 and have code below for run some processes, but I have this error: Automation Error: The system can't find the file specified.
Here's my code:
Private Sub cmdRun_Click()
{
Dim wsh as New IWshRuntimeLibrary.WshShell
wsh.Run App.path + "\Process1.exe", 1, True
wsh.Run App.path + "\Process2.exe", 1, True
}
I'm sure that the files Process1.exe and Process2.exe are exist and are in correct path. Any Idea?
Thanks.
While (true) { Human.isLearnable = true; }
|
|
|
|
|
Pedram,
Where is App.path pointing to?
PJC
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi Paul, thanks for reply.
This is my application .exe file path, if it's in (for example) C directory App.path is "C:\".
I tested CurrDir instead of App.path but nothing changed.
Thank you again.
While (true) { Human.isLearnable = true; }
|
|
|
|
|
Where does Process1.exe and Process2.exe reside? You should make sure that App.path is indeed pointing to the location of those two.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I tested Shell App.path + "\Process1.exe" and it worked so my file paths are correct.
While (true) { Human.isLearnable = true; }
|
|
|
|
|
For laughs and giggles, do a debug.print App.path + "\Process1.exe" and debug.print App.path + "\Process1.exe"
Copy and paste each result into the run window and make sure the .exe's run that way.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hello, thank you for your reply,
I'm sure that these file paths are exist and correct. I tested your idea before.
While (true) { Human.isLearnable = true; }
|
|
|
|
|
I second that. It doesn't hurt to put in a little debug diagnostics.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
OK, I found it...
Private Sub cmdRun_Click()
{
Dim wsh as New IWshRuntimeLibrary.WshShell
wsh.Run Chr(34) & App.path + "\Process1.exe" & Chr(34), 1, True
wsh.Run Chr(34) & App.path + "\Process2.exe" & Chr(34), 1, True
}
Thank you all...
While (true) { Human.isLearnable = true; }
|
|
|
|
|
That'll do it every time. Congrats on solving it.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I am running some initializing code for the forms ComboBoxes in the Form Load event. I am populating some ComboBoxes using the ComboBox.DataSource = (Array of a type of object). The object is a listitem class, i set the DisplayMemeber equal to the display string in the object and ValueMember equal to the ID of the object, sample displaystring = ProductName and ID = ProductID.
The SelectedValueChanged event of the combobox triggers a repopulation of the products information for the selected product. The problem is the SelectedValueChanged event is triggering on the Form Load when the DataSource is set for the combobox. I do not want this event to happen during the Form Load event. I only want this event to trigger after the form has loaded and a user changes the SelectedValue or the SelectedValue is changed within code that is no fired off by the Form Load event.
Is there either a way to suppress the ComboBox events, SelectedValueChanged, SelectedIndexChanged, etc., or a way to detect that I am still in the Form Load event/state and conditionally use that to not execute the code in the SelectedValueChanged event?
|
|
|
|
|
add a module level boolean like mblnInit and set it accordingly during the new/load events
IE:
sub form_load (byval sender as object, ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
mblnInit = true
...all your load code here...
mblnInit = false
end sub
In the combo_selectvalue changed:
sub SelectedValueChanged
if not mblnInit then
...repopulate code...
end if
end sub
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Looks to be the old KISS method
I thought there were state trackers, but this works just as well.
|
|
|
|
|
i wants to create property in a class at run time with different names and datatypes.. thanks
Muhammad Ismail Khan
SoftWare Developer CRM(Islamabad), Pakistan
|
|
|
|
|
Possible, but hardly practical. You'd have to use reflection to do this. I don't know of any examples on the web, nor do I have any myself.
Usually, if this comes up, I would have to question the design. Why do you think you have a need for this?
|
|
|
|
|
Dave Kreskowiak wrote: Why do you think you have a need for this?
Looking at the subject line, rum time? I'm so there after a long day. Captain Morgan with Dr. Pepper
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|