VB
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 String) As Byte()
Dim appDataBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(appData)
Dim outputSize As Integer = 20
...
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 product class. Now add a service named Service1 to the...
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 Silverlight 2 App to demo how to do this. I created a silverlight app with a web application project. I prefer web applications to web sites but a web site will...
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 product collection to edit, filter the
collection based on a search phrase, add and remove snippets,
add existing folders, remove folders from the collection and
move snippets around by simple drag and drop.
The code editor...
MSDN Tiki Hut Roadshow
Wednesday, February 18, 2009 6:30 PM - Wednesday, February 18, 2009 9:30 PM Eastern Time (US & Canada)
Welcome Time: 6:00 PM
Space Coast Credit Union Corporate Headquarters
8045 N. Wickham Road
Melbourne
Florida
32940
United States
Session 1 – jQuery with ASP.NET
- JQuery is an open source JavaScript library that has a passionate
following among Ajax developers. Microsoft is integrating the open
source JQuery library into both the ASP.NET Web Forms and ASP.NET MVC
frameworks and providing full product support. Learn how you can take
advantage of JQuery to build richly interactive client-side Ajax
applications when developing either ASP.NET Web Forms or ASP.NET MVC
applications. Also see how JQuery works...
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 a handler to validating event. Private Sub DataRepeater1_DrawItem(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs) Handles DataRepeater1.DrawItem ...
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)
Dim regNum As New Regex("^\d{4}$|^\d{6}$")
Debug.Print(regNum.IsMatch("1234").ToString)
Debug.Print(regNum.IsMatch( "12345").ToString)
Debug.Print(regNum.IsMatch("123456").ToString)
Output
True
False
True
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 bitmap. Then it adds the...
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="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="sm1" EnablePageMethods="true" runat="server">
</asp:ScriptManager>
<table>
<tr>
<td>
Make
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" Width="341px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Model
</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" Width="341px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Color
</td>
<td>
<asp:DropDownList...
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 AutoCompleteStringCollection
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strConn As String
Dim da As SqlDataAdapter
Dim conn As SqlConnection
Dim ds As New DataSet
strConn = "Server = .\SQLEXPRESS;Database = NorthWind; Integrated Security = SSPI;"
conn...
Full VB Archive