tirsdag 11. mai 2010

TableAdapter Editing not allowed

TableAdapter Editing is not allowed for this DataSet.

You are not able to move existing TableAdapter, or configure them. The add TableAdapter is grayed out or disabled.

If you get this error there is something wrong with your dataset. The only way we have solved the problem, is by reverting the dataset to last working version.

lørdag 8. mai 2010

Arrays Tutorial

Compare two string arrays, & list non equal items only

'This will display (on separate lines) b c d g i

Dim roles As String() = {"a", "e", "f", "h"}
Dim allRoles As String() = {"a", "b", "c", "d", "e", "f", "g", "h", "i"}

Dim nextRole As String

For Each nextRole In allRoles
If Array.IndexOf(roles, nextRole, 0) = -1 Then
Response.Write(nextRole & "
")
End If
Next

Array.IndexOf Method
The method returns the index of the first occurrence of a value in a one-dimensional Array or in a portion of the Array. The method returns the index position of the first occurrence of the value if it exist. The method retuns -1 it it doesn’t exist.

tirsdag 4. mai 2010

List tutorial

Make a new “web Site” : “File”, “New Web site”

Add a button and 3 labels to your new site.

Double click the button and you get to:
“Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click” method, in the code behind file.




Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim numberList As New List(Of Integer)
'Add nomber to list
numberList.Add(11)
numberList.Add(12)
Label1.Text = ""

‘loop through list
For Each Items As Integer In numberList
Label1.Text = Label1.Text & " " & Items.ToString()
Next

'clear list
numberList.Clear()
Label2.Text = ""
For Each Items As Integer In numberList
Label2.Text = Label2.Text & " " & Items.ToString()
Next


'Give list Random Number
Dim RandomNumber As Integer
For i As Integer = 0 To 5
RandomNumber = Int((100 * Rnd()) + 1)
numberList.Add(RandomNumber)
Next
Label3.Text = ""
For Each Items As Integer In numberList
Label3.Text = Label3.Text & " " & Items.ToString()
Next

End Sub