|
Hello,
I'm just looking for ideas/techniques to apply to form to handle logon running events and blocking the user from closing the form until those events are done. Is there some formal way to do this or is a just a matter of using boolean to indicate idle status, etc?
Situation:
- user clicks on button causing a transaction
- while the event is processing the user clicks on the Close Button (X).
- the transaction returns and starts processing. it is possible to get the close event to fire while the transaction reply is being processed. So reply is being processed, the close event starts cleaning up objects (set to nothing/dispose) and the event uses one of those objects and 'object not set'.
Note: We are using bubble up error handling so the top of the stack is the button. but we are also using threadexception handling so it too would need to react accordingly.
Thank you for your time...
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Hi,
the FormClosing event has a FormClosingEventArgs parameter; of interest are the CloseReason property, telling you why the form would close, and the Cancel property, which when set to true prevents the form closing.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Thank you for replying Luc...
So basically i would need to create a variable to indicate i'm within a click event and check that flag within the closing event and if the flag is true, then cancel the close else let it happen. i was hoping for some flag that's built into indicate if any of the form's events are "busy"...
thanks again.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
which database should I use in order to achieve the highest speed possible while reading and writing?
I need to write to database once, but read the database quite often
I write about a million strings.
TheMrProgrammer
http://www.icbse.com/2009/funny-exam-answers-school-students
http://download.cnet.com/TheCalcMan/3000-2094_4-10958266.html
|
|
|
|
|
You could:
use sql server and also use sqlcachedependency and dump the table to NT memory. that way you are caching the records in NT memory and it will pole sql server looking for changes. if a change is found, it replaces the cache and again the NT memory is in sink with the database.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
I have an headache from bashing my head against a brick wall and I think Google will start charging me because I'm hogging their search engine.
I am near the end of a large VB .NET 2008 project, where a small client program is installed on the user's PC and then shared DLLs and support files are located on a Windows 2008 Server. The client program uses late binding to utilise the DLLs on the server.
All the assemblies are Strongly Named.
when I attempt to run the client program, I get the error "That assembly does not allow partially trusted callers." at the point that the client attempts to connect to a DLL on the server.
I have tried the following command on my PC (running Vista Ultimate x64)
CasPol.exe -pp off -m -ag 1.2 -url file:\\myServer\myShare\* FullTrust
I still get the same error.
I really am in need of some guidance (or a bullet to the head )
Thanks
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Try inserting all your DLL's into the servers GAC, had a similar problem, this solved it.
|
|
|
|
|
This resolved my issue :-
caspol -m -ag 1 -url file://\\MyServer\MyShare\* FullTrust -exclusive on
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Newbie here again. I need to be able to take data that is in a txt file and import into a table. My senario is, I have 6 txt files that need to be imported/inserted into tables of the same name. The data in the files look like this- "data", "data", and so on. I am using vb.net and my sql server is 2000. How do I go about doing this? Keep in mind that I have no training and am just starting to learn this stuff. Thanks.
|
|
|
|
|
The text files you are describing sound like what are known as 'csv' files (comma separated values), so I suggest that you look at this[^] blog, for solutions.
If you do not understand it, or it simply does not fit your scenario then Google for sql server csv files, which is how I found that link. There are loads of hits, work your way through them till you find one that suits.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi guys,
I am writing (trying to write) a program in VBA for Excel 2003 and I got stuck. I need your help please.
I have an excel range where the upmost cell is initially fixed and the downmost cell moves down as more data arrive.
I have something like WorkRange = Range((1,1), (LastRow.Row,1)).
That range contains integers. I call LastValue.value the value of the integer in cell (LastRow.Row,1).
Over this range I calculate the maximum value (MaxVal.Value) and the difference between LastValue.Value and MaxVal.Value.
So far it's (almost) easy, even for me.
The problem is, when the difference between LastValue and MaxVal satisfies a certain condition ( ie LastValue-MaxValue=z; z=constant) I need to move down the upmost cell in the WorkRange, so that it is set to coincide with the cell where the MaxVal is.
After that the program should me made to loop.
Normally the data series would be 40k rows long, but it could get 500k rows long I am afraid.
IN THEORY I have an idea of how I can solve this problem but I do not know how to do it practically with VBA.
I thought that maybe I could define the upmost cell of the WorkRange as a Cell-object.
For example I could call it StartCell1. The WorkRange would then be:
WorkRange=Range(StartCell1,(LastRow.Row,1)).
StartCell1 would be the first cell where I have data.
When condition ( LastValue.Value-MaxValue.Value=z) is satisfied I could write the program to create a Cell-object called LastCell1 that would be the first cell where the condition is satisfied.
I would also create a Cell-object called MaxVal1, that would be the cell where you find the maximum value in the range up to that point.
Finally I could also create a Range-object called WorkRange1=Range(StartCell1,LastCell1).
Done that I could create a new Cell-object, call it StartCell2 , and set it to have the same properties of Cell-object MaxVal1.
At that point the WorkRange would be WorkRange=Range(StartCell2,(LastRow.Value,1)) and I could loop the program repeating the above.
Does it make sense ?
The problem is that I have no idea on how practically do this.
I am surfing through books and the web but did not find a solution so far.
Probably my question is naive but can anybody please help ?
Thank you in advance
Frank
|
|
|
|
|
Thanks in adv.
Can Some one Tell me any way to Navigate Fast in the Properties of any control in VS (2005,2008,2010)
as in VS 2000 you can go directly to a property by pressing ctrl + shift + 1st Letter (for Name :N) will go inside the Name property.
Best of Regards,
SOFTDEV_SUP
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Not sure about that particular shortcut. But I guess this[^] link will help you out.
Plus, I think Visual Studio forum would have been a better place for this.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
hi guys... im a newbie and a student here in the philippines... i need help.. and i appreciate it in advance...
here is my problem...
i have two datagrids...
grid1 and grid2
grid1 is like a cart...
and the data needed to populate it depends on grid2
by the way grid2 is a booklist
when i select a book from grid2
i should be able to pass the data to grid1
i already populated grid2 with data...
how can i populate grid1 with data coming from grid 2?
another info...
grid1 is in frmPurchasing while grid2 is in another form frmBooklist.
I hope i made it clear.. this is for subject in database programming.
I am using Visualbasic and sql server. thanks
|
|
|
|
|
Basically, you probably have two datagrids bound to datasources, right? All you do is copy the data from one datasource to the other. That's all. I can't give you the implementation details because you haven't provided any detail about your datasources.
I can tell you you're probably going to have an issue with having these datagrids on two different forms. Unless your datasources are exposed globally (not a great idea) or both forms can get to the sources themselves, you've made this process more complicated than it needs to be.
|
|
|
|
|
Hello
Have search far and wide for something that I think should be on MSDN, but no luck. It must be something simple, but I'm not that good with FP.
Anyway, I have List(Of MyObject) that I want to filter for an auto complete box.
Currently, I do this:
NameACB.ItemFilter = New AutoCompleteFilterPredicate(Of Object)(AddressOf NameSearch)
And then have this function for it to land on:
Private Function NameSearch(ByVal search As String, ByVal value As Object) As Boolean
Dim cust As MyCustomer = TryCast(value, MyCustomer)
If cust Is Nothing Then Return False
If cust.Name.ToLower.Contains(search.ToLower) Then
Return True
Else
Return False
End If
End Function
This works fine, but to cut down on the code (and maybe learn somthing), I was trying to use a lambda expression instead. This is what I thing it should look like:
NameACB.ItemFilter = New AutoCompleteFilterPredicate(Of MyCustomer)(Function(f As MyCustomer) If(f.Name= NameACB.Text, True, False))
But this throws a compiler error that the nested function doesn't have the same signature as delegate.
modified on Friday, September 25, 2009 2:27 AM
|
|
|
|
|
Since I'm not really sure what the definition of either AutoCompleteFilterPredicate or NameACB is, I can only point out that you did this the first time:
NameACB.ItemFilter = New AutoCompleteFilterPredicate(Of Object)(...)
and this the second time:
NameACB.ItemFilter = New AutoCompleteFilterPredicate(Of MyCustomer)(...)
The problem may not be with your lambda, but may be with trying to assign a delegate with that signature to a property that expects another signature.
P.S. There's no reason to write If(f.Name = NameACB.Text, True, False) (or it's multi-line equivalent). You can just say Return (f.Name = NameACB.Text) and get the exact same thing with less code the better expresses your intent.
|
|
|
|
|
Thank you for you reply Gideon!
Reading my original message, I realise I've been a bit short.
NameACB is an AutoCompleteBox(ACB), and I have attached a List(Of MyCustomer) to
its ItemsList. Now, MyCustomer has many fields, and when in doubt, ACB
defaults to searching by the .ToString value of an object. Because of some quirks
of WCF, I can't override the .ToString method in my objects, and so I have
to define the .ItemFilter property of the ACB, by way of the AutoCompleteFilterPredicate.
As far as I can tell It just loops trough all the instances in ItemList and returns
True if they match in the prescribed field, and False otherwise, using either a seperate
function or a lambda expression.
Anyway, your suggestion is one of many I tried, without sucess. I suppose it's not so
much a FP question as an UI problem, but if I understand you, you think it should be more like:
NameACB.ItemFilter = New AutoCompleteFilterPredicate(Of Object)(Function(f As MyCustomer) f.Name=NameACB.Text))
|
|
|
|
|
It appears you are using the AutoCompleteBox from the Silverlight library (finally found it). If so, you will need to change the lambda signature to Function(String, Object) As Boolean to match the signature expected by ItemFilter. This means that you will have to cast the item argument inside the lambda, like so:
NameACB.ItemFilter = _
New AutoCompleteFilterPredicate(Of Object)( _
Function(search, f) CType(f, MyCustomer).Name=NameACB.Text) _
)
You cannot pass a lambda of (string, MyCustomer)->Boolean to a function of (string, object)->Boolean because then you could not pass arguments of (string, int).
|
|
|
|
|
Thank you!
This works. And all I had to do was roll the function into one line of code!
I guess I over-thought the whole thing in the beginning. Thanks again.
|
|
|
|
|
Hello
i got all the keys to work in my screen keyboard but i cant get the under score working
i went online and found the hex code for it H5F
Anyone Have any ideas ??
Private Sub Key_US_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Key_US.Click
SetActiveWindow(8975651603260375040)
keybd_event(&H5F, 0, 0, 0)
keybd_event(&H5F, 0, KEYEVENTF_KEYUP, 0)
End Sub
Thanks
|
|
|
|
|
Does the underscore not require the shift key to have been pressed also?
|
|
|
|
|
I try that too
Private Sub Key_US_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Key_US.Click
SetActiveWindow(8975651603260375040)
keybd_event(VK_SHIFT, 0, 0, 0)
keybd_event(&H5f H2D, 0, 0, 0)
keybd_event(&H5f H2D, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0)
|
|
|
|
|
That won't work. The keyboard, not the event system, decides what key is sent when shift is down or not.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
That work perfect for the at simble
Private Sub Key_AT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Key_AT.Click
SetActiveWindow(8975651603260375040)
keybd_event(VK_SHIFT, 0, 0, 0)
keybd_event(&H32, 0, 0, 0)
keybd_event(&H32, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0)
End Sub
every key worked perfect
|
|
|
|
|