Below is the code that is actually closing the whole application when clicked on Yes.
But,I want to close the current form and open the new form when the user clicks on X with red mark i.e. close on the form.The code I wrote is :
<pre lang="vb">Private Sub form1_FormClosing(ByVal sender AsObject, ByVal e As System.Windows.Forms.FormClosingEventArgs) HandlesMe.FormClosing
Dim response As MsgBoxResult
response = MsgBox("Do you want to close?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "confirm")
If response = MsgBoxResult.Yes ThenMe.Dispose()
ElseIf response = MsgBoxResult.No Then
e.Cancel = TrueEndIfEndIf</pre>
I am a in disbelief.
I was experimenting with strongly signed libraries lately and found a couple of surprising things.
I create a program and sign it using a strong name key file:
My first surprise was that if I edit the executable file with a binary editor I can make it display any other number.
It appears that the signatures are not checked at run-time.
I then pushed it a bit further.
I can push the original assembly to the GAC but not the modified version.
As it returns : "Failure adding assembly to the cache: Strong name signature could not be verified."
This is expected and I felt a bit better about it.
...Until I tried to copy the modified assembly directly into the assembly cache folders.
If you look at older publications such as this http://msdn.microsoft.com/en-us/magazine/cc163583.aspx[^] from 2006 you would come to the conclusion that strong naming signing an assembly would give some measure of tamper proofing. So it does come as a bit of a suprise to find that you can fire up a binary editor, change some data and it will still load.
It turns out that load time checks for applications operating in a Full Trust environment were disabled by default when .NET3.5 SP1 was released, a change that affected the behaviour of .NET2.0 as well. This Strong-Name Bypass feature can be enabled or disabled on a system wide basis via a registry setting or a per application basis with an entry in the app.config file.
It's explained in MSDN .NET4 docs[^] although I only found out about this after I had discovered that an edited strong named signed assembly would load without complaint. One would hope that the Authenticode signature mentioned in that reference is protecting the core system assemblies.
I'm just guessing here, but I think this isn't going to work because of the sandboxing of Metro apps. My understanding from talking with some MS guys at Build was that if it wasn't available through one of the share contracts, you were going to be able to do anything with another Metro App.
Hi guys, i'm trying to fetch details of images from a folder like their name and path and i want to save these details in an xml format. can anybody give me some sample code on how to write those details to xml? and then fetch those details on page_load? i just need the xml part.. im stuck. please help. Thanks in advance.
Hi pete,Thanks for the reply. I tried doing that but i'm getting an error. I forgot to mention that i'm trying to do this in a metro app. That is win 8 consumer preview with vs 2011 exp beta. Here is my code. Can u tell me what changes should i make?
//Get file names from folder
StringBuilder output = new StringBuilder();
StorageFolder folder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Big");
IReadOnlyList<StorageFile> file = await folder.GetFilesAsync();
string r= file.Count.ToString();
// int i=file.Count;
foreach (StorageFile file1 in file)
this.one.Text = output.ToString();
XElement xml = new XElement("Images",
from file1 in file
new XElement("Filename", file1.Name),
new XElement("FileSize", file1.Size)
when i run this im getting an error in " xml.save("Data.xml");"
Error1 The best overloaded method match for'System.Xml.Linq.XDocument.Save(System.IO.Stream, System.Xml.Linq.SaveOptions)' has some invalid arguments
Error2 Argument 1: cannot convert from 'string' to 'System.IO.Stream'
You can do following:
1. Create a class with all the properties which you want to save in an XML file.
2. Fetch the details of images from a folder and store it in an object of this newly created class.
3. And then with few lines of code, you can convert this object into XML
At my company we are using excel to register our working hours. I created a very intelligent xls file but because some people use open office i had to remove a lot of it. Now that means that the HR person needs to do a lot of work entering the data from the basic excel sheet to my intelligent work sheet so the calculations are done for her.
For the moment i am trying to create an Excel Add-in using vb.net to do this.
The purpose of the add-in is to import the data from the basic to the intelligent sheet. but i seem to have run in to a problem:
How can i write data into the current XLS file. normally you open the file using code but because it is an excel add-in the file is already open in excel. So how can i use the current open file
Hello all .Net Addicts, seekers, masters and developers
first of all i want to avail the chance to say that i'm very glad now i'm in the .Net world and now that i'm capable to develop under Visual Studio, and as a student, software developing and programming is the best field out there. and now that i'm continuing my engineering studies i need to implement an application for my final project assignment..
and for that purpose i'm looking to create a WPF/WCF chat application that allows the following functionalities :
- communication via lan
- chatting via text, video(webcam) and audio
- exchange files
- save conversation logs
i'm seeking your help to achieve the implementation of this application, so please if there is any samples that i can follow i'll be glad to hear you.
ps: i've already implemented the chat application in this article. WCF / WPF Chat Application[^]
any help would be more than appreciated !!
I write as a novice and happen to own Visual Studio. I have been asked about a business programming language... XBRL which is extensible business reporting language. Can Visual Studio understand XBRL so that applications can be written? Much thanks for an informed reply.
I'm searching for an example of an API hook for ExitWindowsEx.
I want to intercept the Shutdown/Restart of windows, do some stuff and go on with the ShutDown or Restart.
Ik know how to intercept the ShutDown with WM_QUERYENDSESSION but
that doesn't give me back which option the user has chosen: ShutDown or Restart.
I'v been searching the internet now for a few evenings with no results.
I'm using VB6 and VB2008. but any example would be appriciated.
I am not sure if this is allowed or not – if this post is against any Rules i apologize in advance and this post can be removed.
I am in the process of creating a open-source project to track the Psychological Mood of a person, this application will be used by people visiting psychologists.
People that are currently in therapy or want to keep track of mood changes. The program is based on CBT.
To provide to the end-user the tools for him to be able to monitor his mood.
To provide to the therapist additional information for the client through the automatic generation of graphs.
To reduce the international suicide rate.
To make this application available for everyone to use.
We are looking for some volunteers to help with Coding of the Project.
The Project has been seperated into three parts for easier management.
The Desktop Application is coded in VB.NET and using an ORM called nHibernate.
Project URL: http://moodtracker.codeplex.com
The Web-Based Application will be coded in C# and use MSSQL as the Database.
Project URL: http://webmoodtracker.codeplex.com/
The iPhone Application.
Project URL: http://iphonemoodtracker.codeplex.com/
We're aiming to develop a feature-rich Psychological Mood Tracker to help the end-users as much as we can.
If anyone is interested please feel to apply to the CodePlex Project Page.
Thats exactly how it works, if an applicable product upgrade is released during your license term you then yes you get a license for the new version as well. Once your license runs out (and if you don't renew) your existing licenses are still valid (I think theres a few exceptions to this though.)
Something you should know is that most stuff is licensed for "development and testing only", obviously that depends on how you read into that though
Still pretty 'green' behind the ears so just got excited as finally learning to program 'as New' objects.
So I am writting a little program for my sister in fact to randomize Tiles for here kitchen believe it or not. OK so not very exciting stuff but good practise.
Have initial startup form which chooses template eg 4x20 etc and the number of tiles to randomly choose from. Then form TilesAuto1 which prompts you to choose the Tile images. From TilesAuto1 it generates
Public Template As New Form
All works fine up to and including the new form generation and random tiles. I have added a 'random' buttom to re-randomise the tiles.
FINALLY, my question - how do i re-use the new objects i have created in the new form as it previously looped through the template format i.e. 4x20 and 3 tile images. I want to get rid of the currently generated New objects and re-create them. if i use 'dispose' the whole form goes.
If i am making any sense, id appreciate some assistance.
By either setting the properties of them to whatever is required or reassigning them to a different new object.
If I understand you correctly, then your form is creating objects which it uses to create the random layout based on the data entered into the start up form and you want to reuse the form (based on the same start up form data) by clearing it to its initial state?
If so, store the information from the start up form in private fields in the display form so they can be accessed at any point. Create a Reset method where you can do whatever it is you need to do with any controls etc to set them back to the initial state and call that whenever needed.