Click here to Skip to main content
15,924,036 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: why it didn't find the control with its name? Pin
sanyexian8-Dec-10 19:36
sanyexian8-Dec-10 19:36 
Questionhello i have a question about incompatible pointer type [modified] Pin
lxlenovostar6-Dec-10 18:22
lxlenovostar6-Dec-10 18:22 
AnswerRe: hello i have a question about incompatible pointer type Pin
Luc Pattyn6-Dec-10 20:24
sitebuilderLuc Pattyn6-Dec-10 20:24 
AnswerRe: hello i have a question about incompatible pointer type Pin
_Erik_7-Dec-10 1:08
_Erik_7-Dec-10 1:08 
GeneralRe: hello i have a question about incompatible pointer type Pin
lxlenovostar7-Dec-10 4:37
lxlenovostar7-Dec-10 4:37 
QuestionFinding Field Length from DataGridView - SOLVED Pin
chrispowell123456-Dec-10 0:20
chrispowell123456-Dec-10 0:20 
AnswerRe: Finding Field Length from DataGridView Pin
Andy_L_J6-Dec-10 21:08
Andy_L_J6-Dec-10 21:08 
GeneralRe: Finding Field Length from DataGridView Pin
chrispowell123457-Dec-10 1:22
chrispowell123457-Dec-10 1:22 
Hi thanks for the advice (although I don't have a clue what a 'sp' is!)

I found the info I needed in the following way:

once I retirved the data and updated the datagrid view I created a seperate datatable and filled it with the schema table of the datareader

bindingsource.DataSource = datareader
            resultsdatgdvw.DataSource = bindingsource
            resultsdatgdvw.Update()
            resultsdatgdvw.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader)
            Dim datatable As New DataTable
            datatable = datareader.GetSchemaTable()


This puts the metadata for the columns into a table. I then looped round the rows in this table (each row being a column in the datareader) using each rows 'ItemArray' property to first map the row to the column header in the datagrid - ItemArray(0) - and then getting the type - via the datagrids column valuetype - and then maxlength - ItemArray(2) - and then nullable boolean - ItemArray(8).
I added all of this to the header cell of the column corresponding to the row in the datagrid view (I removed the tooltip from the other cells)

For Each row As DataRow In datatable.Rows
              Try
                  resultsdatgdvw.Columns(row.ItemArray(0).ToString).HeaderCell.ToolTipText = "Type: " & resultsdatgdvw.Columns(row.ItemArray(0).ToString).ValueType.ToString.Replace("System.", "") & "   Length: " & row.ItemArray(2).ToString & "   Nullable: " & row.ItemArray(8).ToString
              Catch ex As Exception
              End Try
          Next
          datatable.Dispose()


For some reason the 'key' value in the ItemArray didn't return the correct value but I'm guessing that's just the database I'm using..

Chris
QuestionProblem solved...see code Pin
pbsjr5-Dec-10 5:09
pbsjr5-Dec-10 5:09 
AnswerRe: System.Drawing.Bitmap.save does not save image Pin
Dave Kreskowiak5-Dec-10 7:44
mveDave Kreskowiak5-Dec-10 7:44 
GeneralRe: System.Drawing.Bitmap.save does not save image Pin
pbsjr5-Dec-10 9:43
pbsjr5-Dec-10 9:43 
GeneralRe: System.Drawing.Bitmap.save does not save image Pin
DaveAuld5-Dec-10 9:48
professionalDaveAuld5-Dec-10 9:48 
GeneralRe: System.Drawing.Bitmap.save does not save image Pin
pbsjr5-Dec-10 9:51
pbsjr5-Dec-10 9:51 
AnswerRe: System.Drawing.Bitmap.save does not save image Pin
Luc Pattyn5-Dec-10 7:56
sitebuilderLuc Pattyn5-Dec-10 7:56 
GeneralRe: System.Drawing.Bitmap.save does not save image Pin
pbsjr5-Dec-10 9:44
pbsjr5-Dec-10 9:44 
AnswerRe: System.Drawing.Bitmap.save does not save image Pin
Luc Pattyn5-Dec-10 10:08
sitebuilderLuc Pattyn5-Dec-10 10:08 
GeneralRe: System.Drawing.Bitmap.save does not save image Pin
pbsjr5-Dec-10 10:59
pbsjr5-Dec-10 10:59 
GeneralRe: System.Drawing.Bitmap.save does not save image Pin
Luc Pattyn5-Dec-10 11:08
sitebuilderLuc Pattyn5-Dec-10 11:08 
Question"Cannot open any more tables" happens when I optimize my code [modified] Pin
i_kant_spel4-Dec-10 19:04
i_kant_spel4-Dec-10 19:04 
AnswerRe: "Cannot open any more tables" happens when I optimize my code [modified] Pin
Luc Pattyn4-Dec-10 23:27
sitebuilderLuc Pattyn4-Dec-10 23:27 
GeneralRe: "Cannot open any more tables" happens when I optimize my code Pin
i_kant_spel5-Dec-10 7:58
i_kant_spel5-Dec-10 7:58 
AnswerRe: "Cannot open any more tables" happens when I optimize my code Pin
Luc Pattyn5-Dec-10 8:16
sitebuilderLuc Pattyn5-Dec-10 8:16 
GeneralRe: "Cannot open any more tables" happens when I optimize my code Pin
i_kant_spel5-Dec-10 9:06
i_kant_spel5-Dec-10 9:06 
AnswerRe: "Cannot open any more tables" happens when I optimize my code Pin
Luc Pattyn5-Dec-10 9:52
sitebuilderLuc Pattyn5-Dec-10 9:52 
GeneralRe: "Cannot open any more tables" happens when I optimize my code Pin
i_kant_spel5-Dec-10 10:59
i_kant_spel5-Dec-10 10:59 

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.