Hi, i have this datatable dt3 which looks like:

ADminNo     PaperNo
111411H     3
111411H     18
172828z     3
172828z     18
111380Y     93
111938S     10

How to i get something like:

ConflictingPaper     Numberofstudents    AdminNo
3 : 8                2                   111411H
                                         172828z

so on and so forth.
to populate in a datagridview.

i tried something like:

Dim curadminno As String = String.Empty
                        curadminno = dr3("AdminNo").ToString
                        Dim z, k As Integer
                        For z = 0 To dt3.Rows.Count
                            If dt3.Rows(z).Item(0) = curadminno Then
                                DataGridView3.Rows.Add(String.Format("{1}:{1}", _
                                                   dr3("PaperNo").ToString()))

its wrong though.

appreciate if anyone could help me out with this!
Thanks!

Recommended Answers

All 4 Replies

First off, you never said how you store the student count. We can't see where this is being stored, so we can't fully help you with your desired format.

Second off, the String.Format statement is incorrect, you would be passing in PaperNo 5 and would get:

5 : 5

As an outcome

The String.Format documentation can be found here.

whaht do you mean by where is it stored? hmm, these data is stored in datatable memory, dt3.
as for the counter, is something i want to add in to see how many common students are there in the conflicted papers.

Stored as in where are you keeping track of these students?

Are you storing them in a table, workbook, or just creating random numbers?

i stored them in datatable. i have the "AdminNo" column in my access database too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.