|
Of course.
Was working before.
I think I found that the cause of the problem is this line of code in Load event :
Application.AddMessageFilter(filter1)
where filter1 is a IMessageFilter.
This filter prevent users clicking on a specific form's area when a condition is true. When I remove this line of code , the shown event is fired.
But what has to do this with a form shown ???!!! And why on other forms ( where I have also exactly this line of code ) everything is working perfectly ?
|
|
|
|
|
Post the code for your IMessageFilter implementation.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Imports System.Windows.Forms
Public Delegate Sub InsideDelegate(ByRef value As Boolean)
Public Class MyMessageFilter
Implements IMessageFilter
Public Event Inside As InsideDelegate
Private Const WM_LBUTTONDOWN As Integer = &H201
Private Const WM_LBUTTONUP As Integer = &H202
Private Const WM_PAINT As Integer = &HF
Public Function PreFilterMessage(ByRef m As Message) As Boolean Implements IMessageFilter.PreFilterMessage
If m.Msg = WM_PAINT Then
Return False
End If
Return OnInside()
End Function
Private Function OnInside() As Boolean
Dim _inside As Boolean = True
If InsideEvent IsNot Nothing Then
InsideEvent(_inside)
End If
Return _inside
End Function
End Class
|
|
|
|
|
So either InsideEvent is Nothing , or it's setting the parameter to True , and your IMessageFilter is cancelling every message except WM_PAINT .
You've declared constants for WM_LBUTTONDOWN and WM_LBUTTONUP ; did you intend to test for and cancel those specific messages?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
yes , I was thinking to test something before.
|
|
|
|
|
|
Yes - don't cancel every message sent to your form.
Most Windows Forms events are raised in response to window messages. If you cancel all messages being sent to the form, then you shouldn't be surprised when things stop working as expected.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sorry , but the filter became active only when a condition is true.
This condition became true only if the user press a button. But the user can't press a button when the form is not shown. so before the form is shown , the filter has no effect.
|
|
|
|
|
When you add the filter in the form's Load event, you prevent any further messages from being sent to the form. (As I said before, either InsideEvent is Nothing , or it's setting the parameter to True .)
That prevents the form from receiving the message telling it that it has been activated, which prevents it from raising the Shown event.
Adding a filter which prevents any window messages from being sent to your form is a very bad idea. You should not be surprised when it breaks things in interesting ways!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Private Sub filter_Inside1(ByRef value As Boolean)
value = condition1
End Sub
Dim condition1 as Boolean=false
On form's load event :
AddHandler filter1.Inside, AddressOf filter_Inside1
Application.AddMessageFilter(filter1)
As you can see at the beginning the filter is not active because the value=false.
And I repeat , that I have this scenario in all my forms , but only this form has the problem.
|
|
|
|
|
Then there's something else going on that you haven't shown us.
It's still a very bad idea to cancel all window messages for a form. Your filter should only be cancelling the specific messages that you want to block.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If it was something else , why the problem is resolved when I remove the line of code that add the filter to application ?
And just to clarify , I doesn't cancel all messages to the entire form. The condition that enable/disable the filter become true only if some other conditions are true and if the user click with mouse in some specific area.
|
|
|
|
|
Since I can't see your screen, access your hard-drive, or read your mind, the only information I have available is what you have posted in this thread.
Based on that information, there are two possibilities:
- The filter is active when the form is loaded, which means you are cancelling every message being sent to the form;
- The filter is not active when the form is loaded, and something else which you haven't shown us is happening on that specific form;
If removing the filter fixes the problem, then I'm inclined to think it's #1. However, since you keep insisting that the filter is not active when the form is loaded, then that only leaves #2.
Finding the real cause of the problem will involve debugging your code. YOU are the only person who can do that.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
Migrating the applications from iis 6.0, windows 2003 R2 to iis 7.0, windows 2008 R2. Getting an error from ASP applications which are using the Vb components.I have tried to rebuild the VB dll with binary and project compatibility. But still i am getting this error ASP ProcessRequest: (91) Object variable or With block variable not set. Dll was generated using windows 7 Operating system. Any idea what is wrong?
|
|
|
|
|
murali_yaragalla wrote: Object variable or With block variable not set You have a null reference. Use your debugger to find out where it is.
|
|
|
|
|
Hi I am Daniyal Shahzad
I need a help in vb 6.0
Remote control car interface with vb program
please send a program of vb
with parallel ports
|
|
|
|
|
It may be possible that there are sample applications and source code online if you ask google nicely; however, no one here will provide you with all the source code.
If you get stuck on some specific code, please come back and ask.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have code VBA code written in MS Access 2010 (.mbd file) to write data into an Excel file (.xls file). Below is the code to write data into that excel file. When you run this code, it always throws Error#1004 "Application-defined or Object-defined error". When you debug the code (F8) or run it (F5), it runs absolutely fine with out any issues. I am still not able to figure it out on what exactly the issue is. This code works fine when executed in MS Access 2007.
Below is thr code that's getting executed and when it fails, the focus is set on the 3rd last line of the code marked in double astriek mark.
Sub PopulateReport(appExcel As Object, testcam)
Dim Site As String, intRec As Integer, i As Integer, cnt As Integer, intRecSet As Integer, cntr As Integer
Dim F1 As String, F2 As String, F3 As String, F4 As String, F5 As String, F6 As String, F7 As String
Dim F8 As String, F9 As String, F10 As String, F11 As String, F12 As String, F13 As String, CAMDate As Date
Close
i = 0
cnt = 0
cntr = 0
Set cnn = CurrentProject.Connection
rec.Open "SELECT * FROM Site", cnn, adOpenStatic, adLockPessimistic
rec.MoveLast
rec.MoveFirst
intRec = rec.RecordCount
Do Until cnt = intRec
rec.MoveLast
rec.MoveFirst
rec.Move cnt
Site = rec(4)
Select Case Site
Case "Fort Worth"
cntr = 0
recset.Open "SELECT * FROM Employee", cnn, adOpenStatic, adLockPessimistic
recset.MoveLast
recset.MoveFirst
intRecSet = recset.RecordCount
appExcel.Application.Goto Reference:="START_FW_CL"
Do Until cntr = intRecSet - 1
appExcel.Selection.EntireRow.Copy
appExcel.Selection.EntireRow.Insert
cntr = cntr + 1
Loop
appExcel.Application.CutCopyMode = False
appExcel.Application.Goto Reference:="START_FW2_CL"
go = appExcel.Application.Range("START_FW2_CL")
cntr = 1
With appExcel.Worksheets("Accts. > Clearing").[START_FW2_CL]
Do Until recset.EOF
**.Offset(cntr, 0) = recset(0)**
.Offset(cntr, 1) = recset(1)
.Offset(cntr, 2) = recset(2)
End Sub
|
|
|
|
|
It appears that appExcel.Worksheets("Accts. > Clearing").[START_FW2_CL] may be null then. Or you may have to set Offset(cntr,0).Value or whatever it's property is.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi
It seems that appExcel.Worksheets("Accts. > Clearing").[START_FW2_CL] is not null because after pressing F8 or F5 its moving ahead and inserting values into excel sheet.
Please suggest why we are getting Runtime Error - 1004 "Application-defined or Object-defined error"
|
|
|
|
|
Hello
I am using VB.net & Visual Studio 2013 , I like to write a Windows CE application
After searching on the internet I installed VS Update 4, vsSdk, Windows Mobile 6 Standard SDK Refresh, Windows Mobile 6.5 Professional Developer Tool Kit (USA), But nothing is working ,I still don't get the template I did a lot of reading on this issue but I still don't know what do I need to install or where to get it in order to write a VB.net Windows CE application ,
Thanks, Shay
|
|
|
|
|
Dear Sir
I am using ms excell as database in vb 6.0 , i am having two sheets (tabel) one is having master another one is outstanding
master table is not contain some CODE and NAME.
i want the result of Which CODE and name is not in master
and that code also want to update in master sheet
I Donnot know how to insert the excel sheet here
Regards
mano
|
|
|
|
|
While you can use a join or other techniques to use data from two separate sheets (have a look at http://www.louiebao.net/blog/201112/join-two-worksheets-using-microsoft-ace-oledb-12-0/[^]) in my opinion you really should:
- replace VB6 with some other environment. Perhaps VB.Net Express edition if you need a free environment. VB6 has been discontinued years ago and is not supported
- not to use Excel as a database. Instead you can use for example SQL Server Express edition (again a free environment). When data handling operations get more complex Excel is no more able to provide tools and techniques you need to handle complex situations
|
|
|
|
|
I am using the following code to get an image from a file.
Using stream As New FileStream(sImageFilename, FileMode.Open, FileAccess.Read)
Dim img As Image = Image.FromStream(stream)
End Using
Now what I would like to do instead is get the Image from my Resource file. I think I need to use MemoryStream but I am not sure how to use it.
Any help is greatly appreciated.
|
|
|
|
|
So it is embedded in my.resources?
Okay, you could extract the image (
My.Computer.FileSystem.WriteAllBytes(PathToExtract, My.Resources.ImageA, False) )
Then, what you can do is get the image and set it in a picturebox etc.
PictureBox1.Image = Image.FromFile(FileLocation)
|
|
|
|