|
Dear All,
I am trying to use form closing event for poping message for saving the data before closing the application with X at upper right corner.
But my code is not working. my application closes without poping message box.
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
Dim a As Integer
a = MessageBox.Show("Are you sure to close", "Text", MessageBoxButtons.YesNo)
If a = 6 Then
'Application.Run()
e.Cancel = False
Else
' Application.Exit()
e.Cancel = True
End If
End Sub
Thanks in advance........
kisran
modified on Tuesday, September 16, 2008 2:40 AM
|
|
|
|
|
Hello Kisran,
I am not sure whats wrong at your side. But your code works perfectly at my end.
In case you are not able to resolve it, you can probably try this slight modified
version of your code.
BEGIN CODE
<br />
Dim dr As DialogResult = MessageBox.Show("Do you wish to close the Form", "Closing Form", MessageBoxButtons.YesNo)<br />
If dr = Windows.Forms.DialogResult.Yes Then<br />
e.Cancel = False<br />
Else<br />
e.Cancel = True<br />
End If<br />
END CODE
I hope this works.
Regards,
Allen
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Thanks allen but this still not working.......
kisran
|
|
|
|
|
Try the following code :
Protected Overrides Sub OnClosing(ByVal e As System.ComponentModel.CancelEventArgs)
dim res
res=msgbox("Do you want to close?",msgboxstyle.yesno,"sample")
if res=vbno then
e.cancel=false
else
e.cancel=true
endif
MyBase.OnClosing(e)
Hope the above code will work...
|
|
|
|
|
Still Not working Gagan............ Its giving compile time error on
MyBase.OnClosing(e)
Error: OnClosing(e) is not a member of system.web.ui
can you Please Help me
kisran
modified on Tuesday, September 16, 2008 2:39 AM
|
|
|
|
|
Try again this one:
Protected Overrides Sub OnClosing(ByVal e As System.ComponentModel.CancelEventArgs)
dim res
res=msgbox("Do you want to close?",msgboxstyle.yesno,"sample")
if res=vbno then
e.cancel=false
else
e.cancel=true
endif
MyBase.OnClosing(e)
end sub
Put end sub after mybase.onclose(e) statement
|
|
|
|
|
Hello All,
How can I create a setup for updates using VS 2005?
This update setup should contain only new/modified files. And when this update setup file will run, it should automatically detect the installed path, and must be able to copy/overwrite the new files.
Thanks in advance...
Amit
|
|
|
|
|
Your question is pretty vauge for such a broad topic. There are all kinds of different settings that need to be tailored to your specific project. You should probably start by reading some articles[^] or doing some google searches[^]. You may want to specifically search for the keyword ClickOnce[^], which is an easy to use deployment for VS 2005 but has some limitations.
Hope this helps.
|
|
|
|
|
Simple databinding works fine with the following code.
Text.DataBindings.Add(Text",datatable1,"Name")
Could anyone suggest on how to do Databinding in Design mode in VS 2005
modified on Thursday, September 18, 2008 1:01 AM
|
|
|
|
|
Hello,
First of all, you need to set the DataSource and DataMember for the BindingSource. Then you can
use set the desired bindingSource.ColumnName in the Text property under DataBindings() in the
Properties Windows(Located at the top on the window) of the TextBox.
In the MoveNext and MovePrevious buttons, you can simply define the following code:
BindingSource1.MovePrevious()
or
BindingSource1.MoveNext()
For more information, you can visit the given link:
http://www.codeproject.com/KB/grid/BindSourceBindingNavCS.aspx[^]
I hope this will help.
Regards,
Allen
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|
|
I have a HTML help file
but my project is updated now how we change the images in this
Amit Battan Ror
battan20@gmail.com
|
|
|
|
|
I am using Vb.net 3.5 as FrontEnd.
When I am Open a Modal Form such as any Message box. I want to Chnage the Background Form Faded.
that means I want to Show the users the Active and DeActive form.
I am applying the Opecity to 50% of the background form,but that is a problem. becase, by changing the Opecity the Background form is transperant that is not I want.
when I am using another form as faded Form, and opened before the modal form that is not good enogh. because, the whole things get flicker, I need a smooth task.
Can it be Possible,So how can I do that. Please give me a suggestion.
|
|
|
|
|
i have some items in dropdownlist.if user press abc on keyboard so correspondent entry in dropdownlist should be appeared.there is no such functionality in control.we have to create some javascript code or something else.if anyone can give some idea so help me.....
|
|
|
|
|
Ajax has just become your best friend - it does this.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
How we edit a HTML help file using HTML Help wrokshop for a VB6 project
full procedure
i am new with the Help file genration
|
|
|
|
|
Hi,
I have one problem in windows application. Please any one help for this situation. The situation is
I had two applications x1 and x2. if I execute the application x1 then it has to pass the strings (may be the application name say 'Testing',user say 'Surya' ...) to the application x2 which is already in a running state.
Thanks in Advance,
Karthiyayini
modified on Monday, September 15, 2008 3:20 AM
|
|
|
|
|
I really don't recommend DDE because (1) there are better ways, and (2) .Net does not support DDE. If you absolutely have to use DDE then check out NDde[^]. Preferably, check out one of the many articles on pipes like this one[^].
|
|
|
|
|
Hi,
Im using a Pie Chart from Component art & was wondering if you could add a click event on the legend, so it will redirect to another page.
Thanks in advance.
|
|
|
|
|
Your best bet is to ask the vendor.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
|
Please help..........
How to refresh font folder after installing new fonts by application setup?? by using Vb.Net
Hitesh sojitra
modified on Monday, September 15, 2008 2:45 AM
|
|
|
|
|
After copying fonts to Fonts folder, you will need to use AddFontResource Api function.
You may also check following link to get more information about this method –
http://www.pinvoke.net/default.aspx/gdi32/AddFontResource.html
-Dave.
------------------------------------
http://www.componentone.com
------------------------------------
|
|
|
|
|
I have a textbox with AutoCompleteSource set to CustomSource. AutoCompleteCustomSource has to be of type AutoCompleteStringCollection. During suggestions, .NET uses--I believe--sort on strings and gives suggestions. So if the string collection contains: 22, 26, 2162, 2052, 2002 and user types in 2 it will suggest 2002, 2052, 2162, 22, 26 because this is ascending order for strings. However, I want it to suggest in ascending order for integers so suggestion will be: 22, 26, 2002, 2052, 2162.
Even if the source for AutoCompleteCustomSource is sorted it get resorted based on string sort. Any ideas how I can show them in ascending order of integers?
|
|
|
|
|
Please don't cross post, you already asked this in the C# forum. Just because you didn't get an answer quickly posting to another forum will not help. If you bothered to use Google you could have found the answer anyway.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I did use Google and I did not find an answer. I need help and since I did not get it in the C# forum I thought I will give it a try here as vb.net developers are more familiar with .NET controls--at least that is what I think.
Ashfield wrote: If you bothered to use Google you could have found the answer anyway.
Can you provide a link?
|
|
|
|