Click here to Skip to main content
15,886,963 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionProblems with TCPClient and TCPListener [modified] Pin
softwarejaeger19-Apr-08 0:11
softwarejaeger19-Apr-08 0:11 
GeneralRe: Problems with TCPClient and TCPListener Pin
Rob Smiley19-Apr-08 0:32
Rob Smiley19-Apr-08 0:32 
GeneralRe: Problems with TCPClient and TCPListener [modified] Pin
softwarejaeger19-Apr-08 1:58
softwarejaeger19-Apr-08 1:58 
GeneralRe: Problems with TCPClient and TCPListener Pin
Rob Smiley19-Apr-08 2:31
Rob Smiley19-Apr-08 2:31 
GeneralRe: Problems with TCPClient and TCPListener Pin
softwarejaeger20-Apr-08 19:51
softwarejaeger20-Apr-08 19:51 
GeneralSending information between apps: code Pin
Jimilybibilybob18-Apr-08 23:17
Jimilybibilybob18-Apr-08 23:17 
GeneralRe: Sending information between apps: code Pin
Dave Kreskowiak19-Apr-08 4:22
mveDave Kreskowiak19-Apr-08 4:22 
GeneralDataRow Cast Exception Error Pin
Member 323293418-Apr-08 21:19
Member 323293418-Apr-08 21:19 
Hello,

I am trying to do the following:
Private Sub GetDepartmentTest()
        Dim myDataset As New DataSet("Databasename")

        'load data from xml file
        myDataset.ReadXml("C:\XmlDatabase\Data.xml")

        Dim myDataRow As DataRow = myDataset.Tables("Department").Rows(0)

        ' the next line gives an error
        Dim myDepartment As Department= myDataRow

        MsgBox(myDepartment .Name)
    End Sub

Class Department
        Inherits Data.DataRow

        Public Sub New(ByVal builder As DataRowBuilder)
            MyBase.New(builder)
        End Sub

        Property Name() As String
            Get
                Return Item("name")
            End Get
            Set(ByVal value As String)
                Item("name") = value
            End Set
        End Property
    End Class


But I keep getting an error:
<br />
System.InvalidCastException was unhandled<br />
Message="Unable to cast object of type 'System.Data.DataRow' to type 'Department'." <br />


The error occurs on this line:
Dim myDepartment As Department= myDataRow

Can someone tell me what I do wrong?
GeneralRe: DataRow Cast Exception Error Pin
Mycroft Holmes18-Apr-08 22:37
professionalMycroft Holmes18-Apr-08 22:37 
GeneralNeed help in Vb.net Pin
RameshMorasa18-Apr-08 21:16
RameshMorasa18-Apr-08 21:16 
GeneralRe: Need help in Vb.net Pin
Rajesh Anuhya18-Apr-08 21:27
professionalRajesh Anuhya18-Apr-08 21:27 
GeneralRe: Need help in Vb.net Pin
leckey19-Apr-08 5:11
leckey19-Apr-08 5:11 
GeneralOn screen keyboard code Pin
Jimilybibilybob18-Apr-08 11:28
Jimilybibilybob18-Apr-08 11:28 
GeneralRe: On screen keyboard code Pin
Christian Graus18-Apr-08 12:39
protectorChristian Graus18-Apr-08 12:39 
GeneralRe: On screen keyboard code Pin
Mycroft Holmes18-Apr-08 22:39
professionalMycroft Holmes18-Apr-08 22:39 
GeneralRe: On screen keyboard code Pin
Jimilybibilybob18-Apr-08 23:13
Jimilybibilybob18-Apr-08 23:13 
GeneralRe: On screen keyboard code Pin
Dave Kreskowiak19-Apr-08 4:14
mveDave Kreskowiak19-Apr-08 4:14 
GeneralRe: On screen keyboard code Pin
Jimilybibilybob19-Apr-08 4:33
Jimilybibilybob19-Apr-08 4:33 
GeneralAuto select in a text box Pin
sa_runner18-Apr-08 11:21
sa_runner18-Apr-08 11:21 
GeneralRe: Auto select in a text box Pin
Christian Graus18-Apr-08 12:47
protectorChristian Graus18-Apr-08 12:47 
GeneralRe: Auto select in a text box Pin
Thomas Stockwell18-Apr-08 14:31
professionalThomas Stockwell18-Apr-08 14:31 
GeneralRe: Auto select in a text box Pin
Rob Smiley19-Apr-08 0:42
Rob Smiley19-Apr-08 0:42 
Questionlistview control problem Pin
monafr8118-Apr-08 8:42
monafr8118-Apr-08 8:42 
GeneralRe: listview control problem Pin
Dave Kreskowiak18-Apr-08 9:56
mveDave Kreskowiak18-Apr-08 9:56 
GeneralRe: listview control problem Pin
monafr8118-Apr-08 10:03
monafr8118-Apr-08 10:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.