Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7570743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:29:59+00:00 2026-05-30T15:29:59+00:00

I am absolutely new to VB.NET, i’ve done some vbS a long time ago.

  • 0

I am absolutely new to VB.NET, i’ve done some vbS a long time ago.

Now I am trying to make a MVP kinda system and I am trying to define and load an array, through the system. Then read it out and it should populate a ListView1 object.

Can anyone shine some light on why it doesn’t populate. I know they are set correct, because the console tells me it’s set ok.

I know the sample would fill with the same item (a week to be exact) every time i add an item, but that’s not the point.

Also, is it possible to define the array without the index, i mean now i set it with (6) so it sets 6 blocks for strings, but I would like to be more flexible.

Is there a way like in php for example
$item[“firstname”]
$item[“lastname”]
…

thanks you for your time and effort! 🙂

ClientlistItem.vb (definition of the actual item)

Public Class ClientlistItem

    Private entry(6) As String

    Public Sub New(ByVal iEntry() As String)
        entry(0) = iEntry(0)
        entry(1) = iEntry(1)
        entry(2) = iEntry(2)
        entry(3) = iEntry(3)
        entry(4) = iEntry(4)
        entry(5) = iEntry(5)
    End Sub

End Class

ClientList.vb (The model as it were)

Imports System.Collections.Generic

Public Class Clientlist
    Public Event ClientlistChanged()
    Private mItems As List(Of ClientlistItem) = New List(Of ClientlistItem)

    Public ReadOnly Property Items() As List(Of ClientlistItem)
        Get
            Return mItems
        End Get
    End Property


    Public Sub AddItem(ByRef iEntry() As String)
        Console.WriteLine(iEntry(0))

        Dim item As ClientlistItem = New ClientlistItem(iEntry)
        mItems.Add(item)
        RaiseEvent ClientlistChanged()
    End Sub
End Class

ClientlistPresenter.vb (the presenter)

Public Class ClientlistPresenter
    Private iEntry() As String
    Private mClientlistModel As Clientlist
    Private mClientlistView As ClientlistView

    Public Sub New(ByRef view As ClientlistView)
        mClientlistModel = New Clientlist
        mClientlistView = view
        mClientlistView.Init(mClientlistModel, Me)
    End Sub

    Public Sub AddItem(ByVal iEntry() As String)
        mClientlistModel.AddItem(iEntry)
    End Sub
End Class

ClientlistView.vb (the view.. this has the LIstview I would like to fill)

Imports System.Windows.Forms

Public Class ClientlistView
    Private mClientlistPresenter As ClientlistPresenter
    Private WithEvents mClientlistModel As Clientlist

    Private Sub OrderView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        mClientlistPresenter = New ClientlistPresenter(Me)
    End Sub

    Private Sub Orderview_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Resize

        Dim fWidth As Integer = Me.Width
        Dim fHeight As Integer = Me.Height
        ListView1.Bounds = New Rectangle(New Point(0, 25), New Size(fWidth, fHeight))
    End Sub

    Public Sub Init(ByRef model As Clientlist, ByRef presenter As ClientlistPresenter)

        mClientlistPresenter = presenter
        mClientlistModel = model


        ' Set the view to show details.
        listView1.View = View.Details
        ' Allow the user to rearrange columns.
        listView1.AllowColumnReorder = True
        ' Display check boxes.
        listView1.CheckBoxes = True
        ' Select the item and subitems when selection is made.
        listView1.FullRowSelect = True
        ' Display grid lines.
        listView1.GridLines = True
        ' Sort the items in the list in ascending order.
        listView1.Sorting = SortOrder.Ascending
        ListView1.Columns.Add("#", 40, HorizontalAlignment.Left)
        ListView1.Columns.Add("Wholename", 140, HorizontalAlignment.Left)
        ListView1.Columns.Add("Date of birth", 80, HorizontalAlignment.Left)
        listView1.Columns.Add("Country of birth", -2, HorizontalAlignment.Center)

        ' Add the ListView to the control collection.
        Me.Controls.Add(listView1)


    End Sub

    Private Sub ClientlistChanged() Handles mClientlistModel.ClientlistChanged


        ListView1.Items.Clear()
        Dim i As Object
        For Each i In mClientlistModel.Items()

        Next

    End Sub

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim week(6) As String
        week(0) = "Sunday"
        week(1) = "Monday"
        week(2) = "Tuesday"
        week(3) = "Wednesday"
        week(4) = "Thursday"
        week(5) = "Friday"
        week(6) = "Saturday"

        mClientlistPresenter.AddItem(week)

    End Sub

End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:30:00+00:00Added an answer on May 30, 2026 at 3:30 pm

    Via the “New ClientlistItem(iEntry)” call in Clientlist.AddItem, you are putting the iEntry elements into the private ClientlistItem.entry member. How exactly did you plan to make the data in “Private entry(6) As String” accessible outside of ClientlistItem?

    One solution is to create a Property inside of ClientlistItem:

     Public ReadOnly Property Items As String()
        Get
            Return entry
        End Get
     End Property
    

    Put this inside your Button1_Click function at the end to confirm that values are getting in and staying in:

        For i As Integer = 0 To mClientlistModel.Items.Count - 1
            For j As Integer = 0 To mClientlistModel.Items(i).Items.Count - 1
                Debug.Print(String.Format("item({0},{1})=", i, j) + mClientlistModel.Items(i).Items(j))
            Next
        Next
        Stop
    

    The “Immediate” window of the IDE should show something like:

    item(0,0)=Sunday
    item(0,1)=Monday
    item(0,2)=Tuesday
    item(0,3)=Wednesday
    item(0,4)=Thursday
    item(0,5)=Friday
    item(0,6)=
    

    That above list should grow with every button click.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, Please forgive my ignorance of C#/.NET, I am absolutely new to both (mostly
I've been trying to develop a way to make rows of an ASP.NET GridView
I'm absolutely new to printing in .NET. I would like to print a page
I am for sure missing some important detail here. I just cannot make .NET's
I'm absolutely new to JavaScript and would like to modify a textarea of a
First of all, I am absolutely new to WP. I am hoping to build
I am absolutely and totally new to rails, so the answer is probably very
I'm new to Rx and am absolutely loving it. I've found existing parts of
I am trying to absolutely position a TinyMCE editor at a set position using
I'm trying to setup Forms Authentication in an asp.net mvc 2 application that will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.