Click here to Skip to main content
15,891,375 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: vb6 how to identify windows 8.1 Pin
Bernhard Hiller6-Nov-13 3:21
Bernhard Hiller6-Nov-13 3:21 
AnswerRe: vb6 how to identify windows 8.1 Pin
TnTinMn5-Nov-13 13:11
TnTinMn5-Nov-13 13:11 
GeneralRe: vb6 how to identify windows 8.1 Pin
MikeD 26-Nov-13 1:00
MikeD 26-Nov-13 1:00 
Questionhello Pin
fatemehbahranian3-Nov-13 19:46
fatemehbahranian3-Nov-13 19:46 
AnswerRe: hello Pin
Mycroft Holmes3-Nov-13 20:12
professionalMycroft Holmes3-Nov-13 20:12 
GeneralRe: hello Pin
GuyThiebaut5-Nov-13 4:47
professionalGuyThiebaut5-Nov-13 4:47 
GeneralRe: hello Pin
Mycroft Holmes5-Nov-13 11:32
professionalMycroft Holmes5-Nov-13 11:32 
QuestionMVVM WPF Datatable to Datagrid binding issue Pin
Member 98926063-Nov-13 8:07
Member 98926063-Nov-13 8:07 
Hi guys,

so I am new to VB.NET and am still trying to wrap my head around MVVM. I think it is a great way of designing an application; however, all I am able to track down on the web are C$ examples and only very little "Over my head" info given in vb.net. Unfortunately I don't have enough time to learn C$ so applying mvvm to vb.net proves difficult at best.

Here is my diellema and please bear with me here if this isn't the correct way of doing things, I am just trying to learn. I have a datatable that I eventually want to show on multiple gridviews in multiple windows.

I created a class called "DataModel"

VB
Imports System.Data
Imports System.ComponentModel
 
Public Class DataModel
    Implements INotifyPropertyChanged
 
    'Public Sub New(ByVal _DT As DataView)
    '    Me.TestDataView = _DT
    'End Sub

    Private _testDataView As New DataView
 
    Public Property TestDataView() As DataView
        Get
            Return _testDataView
        End Get
        Set(value As DataView)
            _testDataView = value
            InvokePropertyChanged("TestDataView")
        End Set
    End Property
 
    Public Sub InvokePropertyChanged(Properties As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(Properties))
    End Sub
 
    Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
End Class


and I am currently adding data at the Application Startup in Application.XAML.vb


VB
Imports System.Data
 
Class Application
 
    ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
    ' can be handled in this file.

    Private Sub Application_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
 

        Dim dataTableView As DataModel
 
        Dim dataTable As DataTable
 
        dataTable.Columns.Add("DeptID", GetType(System.Int32))
        dataTable.Columns.Add("DepartmentName", GetType(System.String))
        dataTable.Columns.Add("HOD", GetType(System.String))
        dataTable.Columns.Add("FacultyCount", GetType(System.String))
 
        Dim row As DataRow = dataTable.NewRow()
        row("DeptID") = 1
        row("DepartmentName") = "CS&E"
        row("HOD") = "John"
        row("FacultyCount") = 20
        dataTable.Rows.Add(row)
 
        row = dataTable.NewRow()
        row("DeptID") = 2
        row("DepartmentName") = "Mech"
        row("HOD") = "Bo Yo"
        row("FacultyCount") = 23
        dataTable.Rows.Add(row)
 
        dataTableView.TestDataView = dataTable.DefaultView
    End Sub
End Class


Here is the MainWindow.xaml (I only created a datagrid to display the datatable and set the datacontext of the window to the class DataModel)


XML
<Window x:Class="MainWindow"
        DataContext="DataModel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="41*"/>
            <ColumnDefinition Width="6*"/>
        </Grid.ColumnDefinitions>
        <DataGrid ItemsSource="{Binding TestDataView}" HorizontalAlignment="Left" Height="273" Margin="10,25,0,0" VerticalAlignment="Top" Width="480" Grid.ColumnSpan="2" />
 
    </Grid>
</Window>


The problem is, there are no errors but I can't see any values in my datagrid. I really don't know what I am doing wrong here. Would any of you guys be willing to help me out? Thank you very much in advance
AnswerRe: MVVM WPF Datatable to Datagrid binding issue Pin
Mycroft Holmes3-Nov-13 12:09
professionalMycroft Holmes3-Nov-13 12:09 
QuestionHow to make an ad blocker for web browser? Pin
AdvantageSoft31-Oct-13 13:05
AdvantageSoft31-Oct-13 13:05 
AnswerRe: How to make an ad blocker for web browser? Pin
Eddy Vluggen1-Nov-13 7:23
professionalEddy Vluggen1-Nov-13 7:23 
AnswerRe: How to make an ad blocker for web browser? Pin
TnTinMn1-Nov-13 8:44
TnTinMn1-Nov-13 8:44 
AnswerRe: How to make an ad blocker for web browser? Pin
Chaim Tovim13-Nov-13 1:22
Chaim Tovim13-Nov-13 1:22 
QuestionProblem regarding datagrid viewbutton column Pin
Member 1019283531-Oct-13 0:54
Member 1019283531-Oct-13 0:54 
QuestionRe: Problem regarding datagrid viewbutton column Pin
Eddy Vluggen31-Oct-13 8:15
professionalEddy Vluggen31-Oct-13 8:15 
Questioneror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Member 1019283530-Oct-13 1:22
Member 1019283530-Oct-13 1:22 
AnswerRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Richard MacCutchan30-Oct-13 2:04
mveRichard MacCutchan30-Oct-13 2:04 
GeneralRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Member 1019283530-Oct-13 20:41
Member 1019283530-Oct-13 20:41 
SuggestionRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Richard MacCutchan30-Oct-13 22:00
mveRichard MacCutchan30-Oct-13 22:00 
AnswerRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
TnTinMn31-Oct-13 9:27
TnTinMn31-Oct-13 9:27 
GeneralRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Member 101928351-Nov-13 21:11
Member 101928351-Nov-13 21:11 
Questionproblem not solved Pin
coolerfantasy29-Oct-13 19:31
coolerfantasy29-Oct-13 19:31 
AnswerRe: problem not solved Pin
Richard MacCutchan30-Oct-13 2:07
mveRichard MacCutchan30-Oct-13 2:07 
AnswerRe: problem not solved Pin
Dave Kreskowiak30-Oct-13 2:32
mveDave Kreskowiak30-Oct-13 2:32 
AnswerRe: problem not solved Pin
Vaclav_3-Nov-13 14:36
Vaclav_3-Nov-13 14:36 

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.