Click here to Skip to main content
15,891,607 members
Home / Discussions / C#
   

C#

 
AnswerRe: I Find This Baffling Pin
Luc Pattyn19-May-10 18:42
sitebuilderLuc Pattyn19-May-10 18:42 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 3:00
professionalRoger Wright20-May-10 3:00 
GeneralRe: I Find This Baffling Pin
Luc Pattyn20-May-10 3:34
sitebuilderLuc Pattyn20-May-10 3:34 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 5:11
professionalRoger Wright20-May-10 5:11 
GeneralRe: I Find This Baffling Pin
Luc Pattyn20-May-10 5:20
sitebuilderLuc Pattyn20-May-10 5:20 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 16:10
professionalRoger Wright20-May-10 16:10 
GeneralRe: I Find This Baffling Pin
Luc Pattyn20-May-10 16:29
sitebuilderLuc Pattyn20-May-10 16:29 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 16:51
professionalRoger Wright20-May-10 16:51 
GeneralRe: I Find This Baffling Pin
Luc Pattyn20-May-10 17:12
sitebuilderLuc Pattyn20-May-10 17:12 
GeneralRe: I Find This Baffling Pin
Luc Pattyn20-May-10 18:08
sitebuilderLuc Pattyn20-May-10 18:08 
GeneralRe: I Find This Baffling Pin
dybs21-May-10 18:35
dybs21-May-10 18:35 
AnswerRe: I Find This Baffling Pin
dybs19-May-10 18:44
dybs19-May-10 18:44 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 3:02
professionalRoger Wright20-May-10 3:02 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 16:17
professionalRoger Wright20-May-10 16:17 
QuestionHttpWebRequest simultaneously!!!! Pin
Christian_V_V19-May-10 18:05
Christian_V_V19-May-10 18:05 
AnswerRe: HttpWebRequest simultaneously!!!! Pin
Luc Pattyn19-May-10 18:45
sitebuilderLuc Pattyn19-May-10 18:45 
AnswerRe: HttpWebRequest simultaneously!!!! Pin
Jens Meyer19-May-10 19:03
Jens Meyer19-May-10 19:03 
AnswerRe: HttpWebRequest simultaneously!!!! Pin
Martin Jarvis20-May-10 6:23
Martin Jarvis20-May-10 6:23 
QuestionNeed to call COM component using reflections in C#.NET Pin
glitteringsound19-May-10 10:46
glitteringsound19-May-10 10:46 
AnswerRe: Need to call COM component using reflections in C#.NET Pin
Hristo-Bojilov19-May-10 23:19
Hristo-Bojilov19-May-10 23:19 
QuestionIcon "Lock Out" Mystery Pin
PDTUM19-May-10 10:37
PDTUM19-May-10 10:37 
AnswerRe: Icon "Lock Out" Mystery Pin
Martin Jarvis20-May-10 6:25
Martin Jarvis20-May-10 6:25 
AnswerRe: Icon "Lock Out" Mystery Pin
PDTUM20-May-10 6:47
PDTUM20-May-10 6:47 
QuestionRe: Grid Column Event Help - Need to fill Grid column with text on the fly Pin
roman_s19-May-10 10:07
roman_s19-May-10 10:07 
QuestionCast Inherited to Base Pin
mbv80019-May-10 9:50
mbv80019-May-10 9:50 
This question applies to VB.net and C# so I posted it here in the hope I will get more answers. However, the code will be presented in VB.net. Feel free to respond in C#
The program bellow trhows an error in the line "mTable2 = mTable.Copy". The error is: "Unable to cast object of type 'System.Data.DataTable' to type 'InherintanceQuestion.InheritedTable". This is because mTables is an instance of the InheritedTable class which inherits a DataTable and mTable is a DataTable. So, is there any way I can create the mTable2 to the mTable.copy to the mTable.


Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim mTable As New DataTable
        Dim mTable2 As New InheritedTable
        mTable.Columns.Add("Col1", System.Type.GetType("System.String"))
        mTable.Columns.Add("Col2", System.Type.GetType("System.String"))
        Dim Row As DataRow = mTable.NewRow
        Row(0) = "A" : Row(1) = "B" : mTable.Rows.Add(Row)
        Row = mTable.NewRow
        Row(0) = "C" : Row(1) = "D" : mTable.Rows.Add(Row)
        mTable2 = DirectCast(mTable.Clone, InheritedTable).Copy
    End Sub

End Class
Public Class InheritedTable
    Inherits System.Data.DataTable
    Private Sub DoSomething()
        'Any code.
    End Sub
End Class

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.