Hi,
I need to create a function that will return the number of columns in a
passed reference to a DataView.
I can find the number of columns in its underlying Data table but have not
been able to find a way of determining the column count in the DataView.
Thanks for any assistance.
Doug 8 6365
I didn't think the two could be different. How do you lose columns when you
apply the table to the dataview?
Chris
"Doug Bell" <dug@bigpond> wrote in message
news:Op******** ******@TK2MSFTN GP09.phx.gbl... Hi,
I need to create a function that will return the number of columns in a passed reference to a DataView.
I can find the number of columns in its underlying Data table but have not been able to find a way of determining the column count in the DataView.
Thanks for any assistance.
Doug
Chris,
Sorry, I didn't really explain that very well.
What I am trying to do is determine the number of columns displayed in a
datagrid.
The datagrid has a grid style applied to it.
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote
in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... I didn't think the two could be different. How do you lose columns when
you apply the table to the dataview?
Chris
"Doug Bell" <dug@bigpond> wrote in message news:Op******** ******@TK2MSFTN GP09.phx.gbl... Hi,
I need to create a function that will return the number of columns in a passed reference to a DataView.
I can find the number of columns in its underlying Data table but have
not been able to find a way of determining the column count in the DataView.
Thanks for any assistance.
Doug
Well This is strange and I don't know what's going on with it, but
Grab a hold of the TableStyles object off your datagrid after the gridstyle
is added. Then look at the Gridcolumnstyle s. This holds all your columns,
but for some reason there isn't a count method on it. However it is really
there and I've used it. So the code below will give you the count, you can
also itterate through all the columns there. Anyone say why the Count
method isn't displayed in Intellisense?
Hope it helps
MessageBox.Show (DGrid.TableSty les(0).GridColu mnStyles.Count( ))
Chris
"Doug Bell" <dug@bigpond> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl... Chris, Sorry, I didn't really explain that very well.
What I am trying to do is determine the number of columns displayed in a datagrid. The datagrid has a grid style applied to it.
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... I didn't think the two could be different. How do you lose columns when you apply the table to the dataview?
Chris
"Doug Bell" <dug@bigpond> wrote in message news:Op******** ******@TK2MSFTN GP09.phx.gbl... > Hi, > > I need to create a function that will return the number of columns in a > passed reference to a DataView. > > I can find the number of columns in its underlying Data table but have not > been able to find a way of determining the column count in the > DataView. > > Thanks for any assistance. > > Doug > >
Thanks Chris,
That is great! And I was a little surprised there was not a count method but
did not think to try it without it being selectable from the intelisense.
Now I can build a re-usable function to size the last column to the
remaining grid width irespective of the selected grid style.
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote
in message news:OW******** ******@TK2MSFTN GP12.phx.gbl... Well This is strange and I don't know what's going on with it, but
Grab a hold of the TableStyles object off your datagrid after the
gridstyle is added. Then look at the Gridcolumnstyle s. This holds all your
columns, but for some reason there isn't a count method on it. However it is
really there and I've used it. So the code below will give you the count, you
can also itterate through all the columns there. Anyone say why the Count method isn't displayed in Intellisense?
Hope it helps
MessageBox.Show (DGrid.TableSty les(0).GridColu mnStyles.Count( ))
Chris
"Doug Bell" <dug@bigpond> wrote in message news:ef******** ******@tk2msftn gp13.phx.gbl... Chris, Sorry, I didn't really explain that very well.
What I am trying to do is determine the number of columns displayed in a datagrid. The datagrid has a grid style applied to it.
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... I didn't think the two could be different. How do you lose columns
when you apply the table to the dataview?
Chris
"Doug Bell" <dug@bigpond> wrote in message news:Op******** ******@TK2MSFTN GP09.phx.gbl... > Hi, > > I need to create a function that will return the number of columns in
a > passed reference to a DataView. > > I can find the number of columns in its underlying Data table but
have not > been able to find a way of determining the column count in the > DataView. > > Thanks for any assistance. > > Doug > >
That's an interesting idea. How are you figuring out how much space is left
on the grid for that column to fill?
Chris
"Doug Bell" <dug@bigpond> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. Thanks Chris,
That is great! And I was a little surprised there was not a count method but did not think to try it without it being selectable from the intelisense. Now I can build a re-usable function to size the last column to the remaining grid width irespective of the selected grid style.
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote in message news:OW******** ******@TK2MSFTN GP12.phx.gbl... Well This is strange and I don't know what's going on with it, but
Grab a hold of the TableStyles object off your datagrid after the gridstyle is added. Then look at the Gridcolumnstyle s. This holds all your columns, but for some reason there isn't a count method on it. However it is really there and I've used it. So the code below will give you the count, you can also itterate through all the columns there. Anyone say why the Count method isn't displayed in Intellisense?
Hope it helps
MessageBox.Show (DGrid.TableSty les(0).GridColu mnStyles.Count( ))
Chris
"Doug Bell" <dug@bigpond> wrote in message news:ef******** ******@tk2msftn gp13.phx.gbl... > Chris, > Sorry, I didn't really explain that very well. > > What I am trying to do is determine the number of columns displayed in > a > datagrid. > The datagrid has a grid style applied to it. > > Doug > > "Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> > wrote > in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... >> I didn't think the two could be different. How do you lose columns when > you >> apply the table to the dataview? >> >> Chris >> >> >> "Doug Bell" <dug@bigpond> wrote in message >> news:Op******** ******@TK2MSFTN GP09.phx.gbl... >> > Hi, >> > >> > I need to create a function that will return the number of columns >> > in a >> > passed reference to a DataView. >> > >> > I can find the number of columns in its underlying Data table but have > not >> > been able to find a way of determining the column count in the >> > DataView. >> > >> > Thanks for any assistance. >> > >> > Doug >> > >> > >> >> > >
An alternate solution is to resize all the column widths to make them larger
proportionally to their current width and the remaining blank space to fill
"Doug Bell" wrote: Thanks Chris,
That is great! And I was a little surprised there was not a count method but did not think to try it without it being selectable from the intelisense. Now I can build a re-usable function to size the last column to the remaining grid width irespective of the selected grid style.
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote in message news:OW******** ******@TK2MSFTN GP12.phx.gbl... Well This is strange and I don't know what's going on with it, but
Grab a hold of the TableStyles object off your datagrid after the gridstyle is added. Then look at the Gridcolumnstyle s. This holds all your columns, but for some reason there isn't a count method on it. However it is really there and I've used it. So the code below will give you the count, you can also itterate through all the columns there. Anyone say why the Count method isn't displayed in Intellisense?
Hope it helps
MessageBox.Show (DGrid.TableSty les(0).GridColu mnStyles.Count( ))
Chris
"Doug Bell" <dug@bigpond> wrote in message news:ef******** ******@tk2msftn gp13.phx.gbl... Chris, Sorry, I didn't really explain that very well.
What I am trying to do is determine the number of columns displayed in a datagrid. The datagrid has a grid style applied to it.
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... > I didn't think the two could be different. How do you lose columns when you > apply the table to the dataview? > > Chris > > > "Doug Bell" <dug@bigpond> wrote in message > news:Op******** ******@TK2MSFTN GP09.phx.gbl... > > Hi, > > > > I need to create a function that will return the number of columns in a> > passed reference to a DataView. > > > > I can find the number of columns in its underlying Data table but have not > > been able to find a way of determining the column count in the > > DataView. > > > > Thanks for any assistance. > > > > Doug > > > > > >
Chris,
Sorry for delay, I had a guy come to fix my garage door.
I am still finding my way with Dot Net but what I am doing is:
1. get number of columns intNumCols
2. get desired width (intDesiredWidt h) and Uused width (intUsedWidth)
Dim intDesiredWidth as Integer = MyGrid.Width
For each ctrl as Control In MyGrid.Controls
If TypeOf ctrl Is VScrollBar Then
If ctrl.Visible Then
intDesiredWidth = intDesiredWidth - ctrl.Width
EndIf
Exit For
EndIf
Next
intDesiredWidth =intDesiredWidt h +39 'Fudge determined by trial & error 39
worked for me
Dim dv1 As DataView = CType(MyGrid.Da taSource, DataView)
Dim stStyle As String = dv1.Table.Table Name.ToString
Dim i as Integer = 0
Do While i <intNumCols - 1
intUsedWidth = intUsedWidth +
MyGrid.TableSty les(stStyle).Gr idColumnStyles( i).Width
i = i + 1
Loop
intDesiredWidth = intDesiredWidth - intUsedWidth
If intDesiredWidth >0 Then
Do Until i = 0
If MyGrid.TableSty les(stStyle).Gr idColumnStyle(i ).Width > 0 Then
'This is the last Visible Column
MyGrid.TableSty les(stStyle).Gr idColumnStyle(i ).Width =
intDesiredWidth
ExitDo
EndIf
i = i - 1
Loop
EndIf
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote
in message news:uH******** ******@TK2MSFTN GP12.phx.gbl... That's an interesting idea. How are you figuring out how much space is
left on the grid for that column to fill?
Chris
"Doug Bell" <dug@bigpond> wrote in message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. Thanks Chris,
That is great! And I was a little surprised there was not a count method but did not think to try it without it being selectable from the
intelisense. Now I can build a re-usable function to size the last column to the remaining grid width irespective of the selected grid style.
Doug
"Chris, Master of all Things Insignificant" <chris@No_Spam_ Please.com> wrote in message news:OW******** ******@TK2MSFTN GP12.phx.gbl... Well This is strange and I don't know what's going on with it, but
Grab a hold of the TableStyles object off your datagrid after the gridstyle is added. Then look at the Gridcolumnstyle s. This holds all your columns, but for some reason there isn't a count method on it. However it is really there and I've used it. So the code below will give you the count, you can also itterate through all the columns there. Anyone say why the Count method isn't displayed in Intellisense?
Hope it helps
MessageBox.Show (DGrid.TableSty les(0).GridColu mnStyles.Count( ))
Chris
"Doug Bell" <dug@bigpond> wrote in message news:ef******** ******@tk2msftn gp13.phx.gbl... > Chris, > Sorry, I didn't really explain that very well. > > What I am trying to do is determine the number of columns displayed
in > a > datagrid. > The datagrid has a grid style applied to it. > > Doug > > "Chris, Master of all Things Insignificant"
<chris@No_Spam_ Please.com> > wrote > in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... >> I didn't think the two could be different. How do you lose columns when > you >> apply the table to the dataview? >> >> Chris >> >> >> "Doug Bell" <dug@bigpond> wrote in message >> news:Op******** ******@TK2MSFTN GP09.phx.gbl... >> > Hi, >> > >> > I need to create a function that will return the number of columns >> > in a >> > passed reference to a DataView. >> > >> > I can find the number of columns in its underlying Data table but have > not >> > been able to find a way of determining the column count in the >> > DataView. >> > >> > Thanks for any assistance. >> > >> > Doug >> > >> > >> >> > >
Dough,
When you still are looking for your original question
\\\
Dim x As Integer = dv.Table.Column s.Count
Dim y As String = dv.Table.Column s(0).ColumnName
'and any other information about a column
///
I hope this helps?
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: LRW |
last post by:
I'm doing the following to try to display queried data into verticle
columns, and I'm getting odd behaviors.
For example, if there are only 4 items to display, it skips item number 3:
Item1 Item4
Item 2
If there are 10 items, it duplicates some:
Item 1 Item 4 Item 7
|
by: Joe |
last post by:
Hi All,
I am new to using the Access DB and I need some help if someone
is able to give it to me. What I want to do is get the names of
the columns of certain tables. Not the data in the table but the
table column names.
I've seen other posts that suggest using the SQL command DESCRIBE
but I can't get it to work for some reason. Other posts have code
samples but they're written in VB which I am not familiar with. I
|
by: keith |
last post by:
I am trying to get a exact count of different distinct entries in an
Access column. At first, I was trying to work with three columns, but
I've narrowed it down to one to simplify it. I've searched Google
Groups for Distinct Count and Count, the Microsoft Help file (which
apparently has bad links in Office 2003), and looked at other files,
but I can't find the answer. The closest I've been able to get is to
create a query to find the...
|
by: jeguillo |
last post by:
I am trying to retrieve the text within each cell in a datagrid in
order to change the color of each cell, depending on the value within
that cell.
This works fine on the cells that are bound columns, but returns an
empty string for the cells that are hyperlink columns.
Here is the code to retrive the text:
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
|
by: Silvio Matthes |
last post by:
Hello,
I'm new to the list and did not find a suitable answer to my question so
here it is:
I try to select the rows of a table where the content of a varchar-column
is empty ('') and PostgresQL is doing a seqscan.
I've tried this on a PostgresQL-Serverversion 7.3.4 and 8.0 beta1.
| |
by: Steph. |
last post by:
I have a List view displaying data in Detail mode with several columns.
How I can get the column index the user clicked on ? (when user click on an item inside the ListView, not on a column hearder..)
Thanks for any help !
|
by: jfarias |
last post by:
Hello all,
The problem I am having is in one of the datagrids I added a new column.
When I run the application data is not shown in the new column. I am using
VS.NET 2003 and am connecting to a sql database(Oracle 10g). Before adding
the new column the other fields show up. The other fields still show up but
not the one I had just added. I am using a sql statement to get the data.
Here is the original sql:
SQL = "Select orgn, name,...
|
by: Kimmo Laine |
last post by:
Hi!
I need to resize the last column in my listview control so that there won´t
be horizontal scrollbar.
Lets first create lv and add some items:
listView1.View = View.Details;
|
by: redeye |
last post by:
Hi All,
I need to do a count of individual items in one column I call status. The status column contains only three values (‘Not Available’, Partially Available’, ‘Fully Available’). My sql statement below just gets me the count for the status column, I need to know how to count the status column for the specific items.
SELECT EEI.EEI_NAME, COUNT(EEI_INSTANCE_RECOVERY.STATUS) AS EXPR1
FROM MTS_EVENT INNER JOIN EEI_INSTANCE_RECOVERY
...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |