|
I need this in a Windows app not a Web app. Sorry for the confusion.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
TwoFaced wrote: But the delayed method just seemed cleanest in my opinion and was just as trivial to pull off.
It's just plain bad practice to put a thread to sleep so a UI elemnt can update. I don't believe in putting in Thread Sleeps anywhere for any reason other than to wait a certain amount of time to repeat a task.
Also, your method leave your control open to failure. If the system gets very busy, your thread sleeps then wakes up, but the process you're waiting on hasn't had a chance to execute. Even if it happens just once out of a thousand times, that's one too many, and it'd be a bitch to debug.
Your method doesn't take into account future changes to the base controls either. Mine, on the hand, doesn't care what the base control does. It patiently waits for the base control to do whatever it wants, for however long it wants, then updates to the control to get the functionality we need, only when the MyBase.Onwhatever call returns.
Oh! And there is also a limit to the number of Timers supported per-process and system-wide.
-- modified at 12:27 Tuesday 15th May, 2007
|
|
|
|
|
I didn't say put the UI thread to sleep. I suggested calling a procedure asyncronosly. This procedure would work on a seperate thread. To be clear this is what I had in mind.
1) The focus event fires
2) In that event we call another procedure asyncronosly
-This allows the normal cursor placement to finish
3) The procedure we called fires and highlights everything in the textbox
Putting the [i]secondary[/i] thread to sleep for a split second was just a precaution to make sure the select all fired late enough. I know your far more knowledable then I and I may be missing the problems this method creates. Even if they would be rare. But thats how I did it and the method seemed to work. I suggested a timer as a secondary option to pull off the delay. In this case putting the thread to sleep obviosly wouldn't be needed and certainly not desired. It was just an alternative thought, not really what I was suggesting.
As you've already made clear it probably is best to create a custom control.
|
|
|
|
|
TwoFaced wrote: I didn't say put the UI thread to sleep. I suggested calling a procedure asyncronosly. This procedure would work on a seperate thread.
This would work, PROVIDED the thread that your thread was waiting for completed its work in the time alloted. If the system is under load, it's entirely possible this won't happen.
TwoFaced wrote: -This allows the normal cursor placement to finish
It assumes that the process completes. It has no way of knowing it.
|
|
|
|
|
friend..
try this out.. this is a VB code, so look out if you can do it in your platform...
Private Sub Text1_GotFocus()
SendKeys "+{END}"
If Text1.SelLength = 0 Then
SendKeys "{END}"
SendKeys "+{HOME}"
End If
End Sub
Private Sub Text1_Click()
Call Text1_GotFocus
End Sub
do reply if its working in .NET
-- modified at 1:45 Wednesday 16th May, 2007
|
|
|
|
|
Why it is said that Delegates are type-safe Function Pointers?
can somebody explain?
|
|
|
|
|
Because the act in a similar way to function pointers do in languages such as C and C++, but in a type safe way. In otherwords, the compiler will complain if you point to a method where the signature doesn't match the delegate.
|
|
|
|
|
Private Sub WriteToDebug()
Debug.WriteLine( "Delegate Wrote To Debug Window" )
End Sub
Dim del As MyDelSubdel = New MyDelSub(AddressOf WriteToDebug)
del.Invoke()
isn't above code is exagerated?
isn't that the following code line is sufficient
call WriteToDebug
|
|
|
|
|
Nilish wrote: isn't above code is exagerated?
If by exagerated you mean "contrived" then yes. It is written like that to show how it works. Not as an example of why you would use it.
Nilish wrote: isn't that the following code line is sufficient
call WriteToDebug
But can you pass the address of the method around in code with that construct? That is the real power of delegates. When an event is raised it uses delegates to call to the event handlers. The code Microsoft wrote knows nothing about your code, so this is a good option for passing the details of the event handler to the windows control. (For example)
|
|
|
|
|
Colin Angus Mackay wrote: But can you pass the address of the method around in code with that construct? That is the real power of delegates.
I admit , what u said
but
isn't that good to accomplish something in less lines of code.
i meant
first i am declaring the delegate
then i am providing the reference of the function.
then i am invoking it.
so three steps
on the other hand just one line of code
call functionname()
|
|
|
|
|
Nilish wrote: so three steps
on the other hand just one line of code
call functionname()
The point of a delegate is that you do separate the process in several steps.
Consider this scenario:
Person A has written a class that person B will use.
Person A has declared a delegate in the code.
Person B provides the reference for the delegate.
Person A has written code that uses the delegate, without needing to know at the time what it will be referencing.
---
single minded; short sighted; long gone;
|
|
|
|
|
Nilish wrote: isn't that good to accomplish something in less lines of code.
We're in the VB forum... and you want to do things with less code.
Nilish wrote: first i am declaring the delegate
then i am providing the reference of the function.
then i am invoking it.
so three steps
on the other hand just one line of code
call functionname()
Well, since delegates are used heavily in event handlers, you might like to work out how many lines of code the equivalent would take without the existance of delegates. Then you will see where you are saving lines of code.
The example shown earlier is, as I've said, contrived to show you how delegates work. It is NOT an example of where or why you would use one, as I've also said before.
|
|
|
|
|
Hello,
VS 2005
Passing data using events between child and parent is not difficult. But how would you handle a event from another form that didn't create instance of that form.
For example. form1, form2, form3.
form1 open form2.
form2 open form3.
How can you handle an event in form1 which has been raised in form3? The 2 are independent of each other, as form1 doesn't have an object for form3.
I have a button on form3 that when pressed should pass some data to form1.
Thanks
|
|
|
|
|
Add 1 module
'Write This line
Public Module Globals
Public Form1Ref as Form
End Module
In the constructor of form1, write
FormRef=Me
Access FormRef from Form3
|
|
|
|
|
steve_rm wrote: How can you handle an event in form1 which has been raised in form3?
You can't. Form1 doesn't even know that an instance of Form3 exists. Form2 would have to subscribe to and handle the event comming from Form3, then, in response to this event, raise an event of it's own that Form1 would have to subscribe to.
|
|
|
|
|
hi,
i get the following error:
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
How it can be resolved.
Thanks,
SD
|
|
|
|
|
r u adding any control?
If yes then the control is not getting the memory. I think
like in vb.net u r adding MSFlexGrid
But at runtime there are problems regarding the memory assignment
-- modified at 7:32 Tuesday 15th May, 2007
|
|
|
|
|
I currentl using VB.NET 2005 with small project, after package and install to client machine i need my application run in services.
Please help me
Regard
Socheat
................
|
|
|
|
|
in service,you should use process.run(" application path")
import necessary namespace
|
|
|
|
|
I know but i want to start it aumomatically after packaged
................
|
|
|
|
|
Then you'll have to write your application AS a service project. There's a template in every edition of Visual Studio .NET, except the Express Editions.
|
|
|
|
|
Hey
I am using vb.net in vs2k5 and .net2.0. I have searched online to try and find a way to create text boxes (on a windows form) with a little bit more of a modern look &= slightly rounded corners. I can't think of anything to search for that doesn't give me back loads of irrelevant answers.
I'm thinking that there must be a reasonably simple way to pull this off.
If someone can kindly point me in the right direction I would appreciate it.
Thanks
|
|
|
|
|
Override OnPaint method and draw whatever shape you want
|
|
|
|
|
Ok, I've never tried anything like that for a textbox. It may be simple, but if someone has a quick example, that could be helpful..
Thanks for the response.
|
|
|
|
|
dear friends,
can any one of you tell me how to verify whether the right click
is on row heading or on the worksheet cell in Excel.
i need to catch this event in my VBA code.
thanks and regards
prahant
|
|
|
|