/Home /Archive /Syndicate /Blog /Support /About /Contact  
All Visual Basic Feeds in one place!





Channel: Ken Tucker

John Papa - Ado.Net Data Services 6/17/2009 6:30:00 PM 6/17/2009 8:00:00 PM About John Papa is a Microsoft C# MVP , INETA speaker , member of the WPF and Silverlight Insiders, consultant, speaker, author, and trainer for ASPSOFT who specializes in professional application development with Microsoft technologies including Silverlight, WPF, C#, .NET and SQL Server. John has written over 70 articles and authored 9 books including his latest book Data Driven Services with Silverli ... [ read more ]


I got email today asking me how to get the device ID from a pocket pc with vb   Imports System.Text Public Class Form1 <System.Runtime.InteropServices.DllImport("coredll.dll")> _ Private Shared Function GetDeviceUniqueID(ByVal appdata As Byte(), ByVal cbApplictionData As Integer, ByVal dwDeviceIDVersion As Integer, ByVal deviceIDOuput As Byte(), ByRef pcbDeviceIDOutput As Integer) As Integer End Function Private Function GetDeviceId(ByVal appData As St ... [ read more ]
I got email today asking me how to get the device ID from a pocket pc with vb   Imports System.Text Public Class Form1 <System.Runtime.InteropServices.DllImport("coredll.dll")> _ Private Shared Function GetDeviceUniqueID(ByVal appdata As Byte(), ByVal cbApplictionData As Integer, ByVal dwDeviceIDVersion As Integer, ByVal deviceIDOuput As Byte(), ByRef pcbDeviceIDOutput As Integer) As Integer End Function Private Function GetDeviceId(ByVal appData As St ... [ read more ]


REST which stands for Representational State Transfer is a way of sending data over the Internet without an additional message layer.  Standard web services use soap for there message header.  In this example we will create a service that uses the northwind database to send a  list of the products for a category.   Lets start by create a new VB web application. In that web application add a Ado.Net Entities data model.  In that class add the northwind database's p ... [ read more ]


Bill McCarthy has moved the Snippet Editor project to Code Plex and added some nice new features Features include: Complete snippet file management basic syntax coloring replacement highlighting drag and drop file organisation The Snippet Editor is a stand-alone exe suitable for all versions of Visual Studio 2005 and 2008 including the Express editions: The left hand pane provides for snippet collection management. You can select which of your p ... [ read more ]


Note this works with the released version of Silverlight 2   I created a Silverlight 2 beta 2 app which uses a WCF Silverlight service which worked fine localy but did call the service when I published it to my web host.  After playing around with the different settings I finally came across an entry in the Silverlight Forums by sladapter with a solution.    http://silverlight.net/forums/t/19021.aspx     So lets create a simple Silverli ... [ read more ]


In this example I will show how to validate the data entered into a datarepeater control. For this example I am added the northwind SQL compact edition database to the project and created a typed dataset for the products table.  So from the toolbox drop a datarepeater on the form.  Inside the datarepeater drag the ProductName, UnitPrice, and Units in stock fields. Your form should look something like     Now in the drawitem event for the datarepeater we can add ... [ read more ]


I got an regualr expression question today from one of my friends.  Basically she was using a regular expression  to validate a number was 4 or 6 digits long but the expression she was using ^\d{4,6}$ would validate numbers 5 digits long.  Lets look at this regular expression ^ means starts with. The \d means number and the {4,6} means 4 to 6 digits long.  The $ means ends with. The answer is to use a regular express with an or (the | means or) Di ... [ read more ]


The .Net framework provides a print document class for printing.  There are times that it would be nice to redirect what you are printing to a pdf.   In this example we are going to use the Sharp Pdf lib version 1.3.1 to print to a pdf.  The sharp pdf lib allows you to add an image to a page in a pdf.  To make it possible to print to a pdf we are going to create a new print controller class which creates a bitmap and has the print document draw the page on the bit ... [ read more ]


Here is simple VB example of the AjaxToolkit's CascadingDropDown extender.  For this example I use the CarsService.Xml found in the AjaxToolkits sample site.  The xml file needs to be placed in the App_data directory   Here is the Pages Html   <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace ... [ read more ]


Here is a quick example on using an autocomplete combobox in the DataGridView.  In this example I load all the possible values for the combobox into a AutoCompleteStringCollection and make that the DataGridViewComboBox's datasource.  In the editingControl showing event you need to set the ComboBox's DropDownStyle, and the auto complete settings.   Imports System.Data.SqlClient Public Class Form1     Dim scAutoComplete As New AutoComple ... [ read more ]


In Feburary 2008 the VB Power packs team released version 3 of there VB Power Packs 2005 .  This version included a DataRepeater control.                The DataRepeater control allows you use standard windows controls to display your data in a scrollable container.   The included documentation shows you how to bind the DataRepeater to a typed dataset.  This article will show you how to bind to a da ... [ read more ]


I had some one ask me an interesting question about using linq with the datagridview When I bind a datagridview to this query Dim names() As String = {"hello11", "hello212", "hello123", "hello124", "hello2325", "hello336", "hello457"} Dim query = From s In names _             Order By s _             Sel ... [ read more ]


In this post we will create a local cache of the Northwind database.  To start with lets create a new visual basic windows forms project in Visual Studio 2008.  From the project menu select add a new item and select a new local database cache and name it northwind.     In the server connect select a connection to the northwind database.   Press the add button and select the product table.  Press OK to close the dialog.  Go ahead ... [ read more ]


The dot net framework 3.0 added the system.speech namespace.  One of the new classes they added is the SpeechRecognizer.  The speech recognizer class has a SpeechRecognized event which you can use to make your application accept dictation.   For this example you need to create a .net 3.0 or .net 3.5 windows forms app.  Place a multi-line textbox on the form.      Imports System.Speech Imports System.Speech.Recognition Public Class ... [ read more ]


When you are running a VB express 2008 on a 64 bit operating system there are times you need to compile the app as a 32bit.   One example is if you need to open an access database.  There is not a 64 bit version of jet. To force your app to use the 32 bit version you need to compile the app for the x86 version of the framework.   Unfortunately there is no built in way to change the target cpu in VB express 2008.  Your best bet is get a copy of Visual studio bu ... [ read more ]


Here is a simple linq query which places the numbers from 1 and 150 in a random order   Dim r As New Random(Now.Ticks Mod Int32.MaxValue) Dim rndLst = From l In (From num In Enumerable.Range(1, 150) _              Select New With {.Num = num, .pos = r.Next(1, 150)}) _              Order By l.pos _          &nb ... [ read more ]


A common question I see in the msdn forums is How do I databind a Listview control on a windows form.  Unfortunately the windows forms ListView does not support databinding.  The wpf version does support databinding and it pretty host on a windows form. Please note you need to have the .Net Framework 3.0 or greater installed for this.   In VS 2008 you will have a WPF Interoperability tab in the toolbox.  Drag a ElementHost on to your windows forms.  In VS 2005 ... [ read more ]


Visual Studio 2008 allows you to switch which version of the .net framework your project targets.  The available options are 2.0, 3.0, and 3.5.  To change the framework version open up your project properties compile tab     You will find the framework option combobox on the form that opens when you press the Advanced Compile Options button       Visual studio will save the project, close, and finally rest ... [ read more ]


© 2005 Serge Baranovsky. All rights reserved.
All feed content is property of original publisher. Designated trademarks and brands are the property of their respective owners.

This site is maintained by SubMain(), a division of vbCity.com, LLC