DataGridView confusion
DataGridView confusion
DataGridView confusion
DataGridView confusion
DataGridView confusion
DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion
DataGridView confusion DataGridView confusion
DataGridView confusion
Go Back  Xtreme Visual Basic Talk > > > DataGridView confusion


Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2014, 03:49 PM
Gruff's Avatar
GruffDataGridView confusion Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default DataGridView confusion


I have a datagridview I am filling with ACE from an Excel worksheet.

Code:
Const sProvider As String = "Provider=Microsoft.ACE.OLEDB.12.0;" Const sSource As String = "Data Source=\\PPD-08\Admin\Test Users.xls;" Const sProps As String = "Extended Properties=" & Chr(34) & "Excel 8.0;HDR=YES" & Chr(34) Const sConn As String = sProvider & sSource & sProps '... Dim s As String = "SELECT * FROM [PC's in Use$] ORDER BY MainUser"

I am seeing an oddball thing happening with the data column order at
different stages of the process. Any way to make them all the same?
---
Excel Column Headers
---
A Cnt
B InUse
C Prefix
D ID
E Loc
F OS
G CPU
H Network
I CAD
J MainUser
K Pwds
L Notes
---
Data Table Column Names
---
0 Cnt
1 Prefix
2 ID
3 Loc
4 OS
5 CPU
6 Network
7 CAD
8 MainUser
9 Pwds
10 Notes
11 InUse
---
GetDisplayCellRectangle(i,-1)
---
0 Cnt
1 Notes
2 InUse
3 Prefix
4 ID
5 Loc
6 OS
7 CPU
8 Network
9 CAD
10 MainUser
11 Pwd
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
  #2  
Old 03-30-2014, 05:57 AM
CharlieMay's Avatar
CharlieMay CharlieMay is offline
Regular
 
Join Date: Sep 2009
Location: Indiana
Posts: 89
Default

Is this your issue?
__________________
I thought I knew what I was doing...
...And then I turned on Option Strict
Reply With Quote
  #3  
Old 04-01-2014, 04:11 AM
Gruff's Avatar
GruffDataGridView confusion Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Don't know. I tried several different ways to clear the issue.

In the end I decided it was foolish to use an Excel spreadsheet for this purpose and
imported the data into an Access database.
I Arranged the field order as I wanted and used that as the source for my datagridview.
The problem went away.

Grid.GetDisplayCellRectangle(<Column>,-1) ' Header Row
Apparently reports the field order of the database not the Columnn order
arranged in the datagridview in the designer at design-time.

The behavior is consistent but unexpected.

All of this came about as I was trying to align a custom menu Item above
each column in the datagridview.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
DataGridView confusion
DataGridView confusion
DataGridView confusion DataGridView confusion
DataGridView confusion
DataGridView confusion
DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion DataGridView confusion
DataGridView confusion
DataGridView confusion
 
DataGridView confusion
DataGridView confusion
 
-->