Alex Mills asked the following question on Channel 8:
I’m building a application that via the use of a windows form, creates XML files that are also visible and editable by this application. What I dont know is how to set the contents of the texts fields to XML. Really what I need is to develop code that when I press save, saves all the text in the text fields into one XML file.
The first thing that came into my mind are the new XML literals that are available with Visual Basic 9 and I pointed him to Sven’s excellent blog post about them.
After a while I thought I could write this short example for him and upload it somewhere. Nothing easier than doing this directly on my blog I have extended the example by a FileSaveDialog instance (added to the Form) that shows a nice “Save as…” dialog when it comes to save the file. The code looks like this:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
‘ if the user did not click on the OK button return. we can do nothing.
If SaveFileDialog1.ShowDialog(Me) <> Windows.Forms.DialogResult.OK Then
‘ get the file name.
Dim fileName = SaveFileDialog1.FileName
‘ compile the xml by using XML literals.
Dim xml = <?xml version=“1.0″ encoding=“utf-8″?>
<firstname><%= firstNameTextBox.Text %></firstname>
<lastname><%= lastNameTextBox.Text %></lastname>
<location><%= locationTextBox.Text %></location>
‘ write the xml to the file.
‘ show a message box with the results.
MessageBox.Show(“The file has been successfully written to: “ + fileName, “Success!”)
A ZIP with the project can be downloaded from here.
I like XML literals because they make creating XMl files a lot easier. Sad that this feature is not part of C#. I really hope that C# will get something like this. The XDocument class (the VB9 compiler translates XML literals into XDocument calls) is nice but still doesn’t offer the easiness of XML literals.
Tommorow, on the 18th of February 2008, we are going to launch Channel 8 DreamSpark. This is exciting news for students because that is the time when you get a lot of Microsoft Software for free! Yeah, you read it right, for free, no charge at all! You only need to sign in with your university e-mail handle to allows us to understand that you really study at a university and then the download fun can begin!
Available will be the following packages:
- Expression Studio
- Sql Server 2005 Express
- Sql Server Developer Edition
- Virtual PC 2007
- Visual Basic 2005
- Visual C++ 2005
- Visual C# 2005
- Visual J# 2005
- Visual Studio 2008
- Visual Web Developer 2005
- Visual Studio 2005 Professional
- Windows Server 2003
- XNA Game Studio
Cool, uh? Isn’t it a huge list?
By the time the software will be available we will also publish a series of webcasts that will introduce you with the software; a getting started package of webcasts! I have done some of them
Keep an eye on Channel 8 to be one of the first to download the software! Happy downloading and playing with the new software!
At TechEd Will and I had the chance to speak with Moe Khosravy, the lead PM (Program Manager) of the Microsoft Sync Framework. The interview is about the framework in general and what you can do with the current available bits.
The Sync Framework is an awesome technology that allows you to sync everything with everything. It is based on so called “sync providers”. They do the work, like reading from a source and writing to a target (that includes also solving conflicts etc.).
More details on the framework are found at the official website of the Microsoft Sync Framework.
While speakers were speaking, people were listening, guards were guarding and cooks were cooking, Will and I met Charles Torre (the dude with the cam and interesting questions on Channel 9) and Barry Dorrans (nickname blowdart in the Channel 9’s Coffeehouse).
We spoke about students, student life, Channel 9, what Charles studied, what Barry “studied”, why we like Robotic Studio *grin* and a lot of other very important stuff!
Tune in if you ever wanted to know who the guys on Channel 9 (posters as in Barry and hard workers as in Charles) are and why Charles started to work for Microsoft after having studied something completely different!
Yesterday the team around Jeff Sandquist has published the next version of Channel 8. I like the new design a lot although there are still some minor flaws that need to be fixed, but I know they will be addressed soon
And what’s best about the new site is that we finally got forums!!! They are a little bit hard to find because named “Student Union”, which is very uncommon over here but they told me that this is the place where students meet to chat in the states. I’m so happy that we finally have them because now we can chat and discuss and everybody can create new topics!
During the European XNA Tour I had the chance to speak with Dave Mitchell. He’s in the XNA team and I could finally ask all my questions on XNA that I had for a long time. We spoke also about the new features that are going to come with XNA 2.0 (that is right now available as BETA from creators.xna.com) and he gave me even some hints on what is going to come in later versions…
Dave showed me also a short trailer of the best games that were in the Dream.Build.Play. contest. I was so excited about it that I packed it right into the video before the actual interview. If you don’t like to watch that, skip the first and half minute to get straight to the interview.
Do you want to win a high-end PC? Are you a student located in the US or outside the US? Max on Channel 8 has started a series where he is going to build a PC and the one with the best comments is going to win it!.
How does it work exactly? Max wrote:
Here’s the fun part… when I’m done, one of you clever community commentators will WIN the new PC!
Start commenting and win a top PC to start the new year with!
At the TechEd’s Microsoft Student Partner evening Will and I were lucky to interview some of the women in the program (if you study computer science you might know how few women are studying with you).
Kateryna Drobotko (from Ukraine), Susana Vilaca (from Portugal) and Diana Tataran (from Romania) talk about their passion for technology and why they joined the Microsoft Student Partner program. We spoke also about what they enjoyed at TechEd and what they are studying on their home universities.
It was very interesting to see why these girls enjoy working with technology and what makes them passionate about it!