Aug 05 2009

Answer by Seth Spearman for Trying to maintaining a DataSet in WinForm App

First,

If you want a good explanation of the issue that Jacob raised read the following article...

http://www.knowdotnet.com/articles/datasetmerge.html

And I agree with the others that you seem to be making it harder than it needs to be.

You are not clear what the ConnectBLL class is...is that a custom bizness object or a strongly typed dataset.

To do databinding which will automatically save would be a very long post so in lieu of that here are a couple of links.

http://www.codeguru.com/columns/vb/article.php/c10815
http://support.microsoft.com/kb/313482
http://msdn.microsoft.com/en-us/library/aa984336(VS.71).aspx

Those were the first links I found on google using (step by step instruction on winforms databinding with a strongly typed dataset) as the search string. You might find a better one. The codeguru link looked pretty good. The other to are more thorough at the expense of being more technical.

Best of all...if you can spring for Chris Sells book in winforms development, the chapters on data binding are excellent (along with all of the other chapters.)

http://www.amazon.com/Windows-Forms-Programming-Microsoft-Development/dp/0321267966/ref=sr%5F1%5F1?ie=UTF8&qid=1249525202&sr=8-1

Hope this helps.

Aug 03 2009

How to render the following asp.net mvc c# code snippet as vb.net code

Working through Pro ASP.NET MVC book and I got the following code snippet that appears in an aspx (view) page...

<%= Html.DropDownList ("WillAttend",new[] 
{
new SelectListItem { Text = "Yes, I'll be there",Value=bool.TrueString},
new SelectListItem { Text = "No, I can't come",Value=bool.FalseString}
},"Choose an option"); %>

Can someone help me convert this to vb.net equivalent.

Any ideas anyone?

EDIT
MORE DETAILS
Here is the whole code snippet. Not sure it will help but here it goes.

<body>
    <h1>RSVP</h1>

    <% using(Html.BeginForm()) { %>
    	<p> Your name:  <%= Html.TextBox("Name") %></p>
    	<p> Your email:  <%= Html.TextBox("Email") %></p>
    	<p> Your phone:  <%= Html.TextBox("Phone") %></p>
    	<p>
    		Will you attend?
    		<%= Html.DropDownList ("WillAttend",new[] 
    			{
    			new SelectListItem { Text = "Yes, I'll be there",Value=bool.TrueString},
    			new SelectListItem { Text = "No, I can't come",Value=bool.FalseString}
    			},"Choose an option") %>
    	</p>
    	<input type="submit" value="Submit RSVP" />
    <% } %>
</body>

Any help appreciated. I REALLY can't figure this one out.

Seth

Aug 03 2009

Is there such a thing as a nullable bool in vb.net

I am working through my new MVC book and of course, the samples are all in c# as usual.

There is a line of code that says

public bool? WillAttend { get; set; }

The author explains that the question mark indicates that this is a nullable (tri-state) bool that can be true, false. or null. (A new C# 3 convention.)

Does vb.net support any convention like this. Certainly I can declare a boolean in vb.net and I can explicitly set it to Null (Nothing in vb.net).

What's the difference. IS there more to it in c#. Advantages?