473,654 Members | 3,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please Help im going Crazy on this one

Hi Group,

Im trying to Format some coloums on my Datagrid so that only 3 Coloums are
show out of the 20 in my Dataset, I just carn`t for the life of me get it to
work, i`ve looked everywhere for info but with no joy. Does anybody have any
example code links? or even better project links? here is my following Code
if anybody can help me with this please

Many thanks
Si

Private Sub frmContracts_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If odcContracts.St ate <> ConnectionState .Open Then odcContracts.Op en()
odaContracts.Fi ll(dsContracts)
Dim aGridTableStyle As New DataGridTableSt yle()
aGridTableStyle .MappingName = "mapcontrac ts"
Dim aCol1 As New DataGridTextBox Column()
Dim aCol2 As New DataGridTextBox Column()
Dim aCol3 As New DataGridTextBox Column()
With aCol1
.MappingName = "ID"
.Width = 0
End With
With aCol2
.MappingName = "Contact"
.HeaderText = "Contact"
.Width = 65
.Alignment = HorizontalAlign ment.Left
.TextBox.Enable d = False
End With
With aCol3
.. MappingName = "Company"
.HeaderText = "Company"
.Width = 50
.Alignment = HorizontalAlign ment.Center
.NullText = ""
.TextBox.Enable d = True
End With
With aGridTableStyle .GridColumnStyl es
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
End With
dgdContracts.Ta bleStyles.Add(a GridTableStyle)
If dsContracts.Tab les(0).Rows.Cou nt > 0 Then
With dgdContracts
.DataSource = dsContracts.Tab les(0)
.Expand(-1)
.NavigateTo(0, "Contracts" )
End With
End If
End Sub
Nov 20 '05 #1
5 1028
Cor
Hi Newbie,

I do not see direct errors.

Maybe I oversee it also, but some things I cannot see.
The membernames, are they in the right cases?

What I see in the code but that has nothing to do with the problem is this
If odcContracts.St ate <> ConnectionState .Open Then odcContracts.Op en()
The dataAdapter opens himself a connection when it is not open, so that one
is not necessary.
odaContracts.Fi ll(dsContracts)


I hope this helps a very little bit?

Cor
Nov 20 '05 #2
Hi,

Before you add the tablestyle to the grid you need to set its
mapping name.

With aGridTableStyle .GridColumnStyl es
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
.MappingName = dsContracts.Tab les(0).TableNam e
End With
Ken
---------------------
"Newbie!" <s_************ @yahoo.co.uk> wrote in message
news:O0******** ************@ka roo.co.uk...
Hi Group,

Im trying to Format some coloums on my Datagrid so that only 3 Coloums are
show out of the 20 in my Dataset, I just carn`t for the life of me get it
to
work, i`ve looked everywhere for info but with no joy. Does anybody have
any
example code links? or even better project links? here is my following
Code
if anybody can help me with this please

Many thanks
Si

Private Sub frmContracts_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If odcContracts.St ate <> ConnectionState .Open Then odcContracts.Op en()
odaContracts.Fi ll(dsContracts)
Dim aGridTableStyle As New DataGridTableSt yle()
aGridTableStyle .MappingName = "mapcontrac ts"
Dim aCol1 As New DataGridTextBox Column()
Dim aCol2 As New DataGridTextBox Column()
Dim aCol3 As New DataGridTextBox Column()
With aCol1
.MappingName = "ID"
.Width = 0
End With
With aCol2
.MappingName = "Contact"
.HeaderText = "Contact"
.Width = 65
.Alignment = HorizontalAlign ment.Left
.TextBox.Enable d = False
End With
With aCol3
. MappingName = "Company"
.HeaderText = "Company"
.Width = 50
.Alignment = HorizontalAlign ment.Center
.NullText = ""
.TextBox.Enable d = True
End With
With aGridTableStyle .GridColumnStyl es
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
End With
dgdContracts.Ta bleStyles.Add(a GridTableStyle)
If dsContracts.Tab les(0).Rows.Cou nt > 0 Then
With dgdContracts
.DataSource = dsContracts.Tab les(0)
.Expand(-1)
.NavigateTo(0, "Contracts" )
End With
End If
End Sub

Nov 20 '05 #3
Thanks for your reply,
When i add:

..MappingName = dsContracts.Tab les(0).TableNam e

I get an error saying D:\Excellence.N ET\Contracts.vb (462): 'MappingName' is
not a member of 'System.Windows .Forms.GridColu mnStylesCollect ion'.

I guess i need to add something else but i don`t know what

Thanks again for you help so far,

Ta
Si

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:uh******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,

Before you add the tablestyle to the grid you need to set its
mapping name.

With aGridTableStyle .GridColumnStyl es
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
.MappingName = dsContracts.Tab les(0).TableNam e
End With
Ken
---------------------
"Newbie!" <s_************ @yahoo.co.uk> wrote in message
news:O0******** ************@ka roo.co.uk...
Hi Group,

Im trying to Format some coloums on my Datagrid so that only 3 Coloums are show out of the 20 in my Dataset, I just carn`t for the life of me get it to
work, i`ve looked everywhere for info but with no joy. Does anybody have
any
example code links? or even better project links? here is my following
Code
if anybody can help me with this please

Many thanks
Si

Private Sub frmContracts_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If odcContracts.St ate <> ConnectionState .Open Then odcContracts.Op en() odaContracts.Fi ll(dsContracts)
Dim aGridTableStyle As New DataGridTableSt yle()
aGridTableStyle .MappingName = "mapcontrac ts"
Dim aCol1 As New DataGridTextBox Column()
Dim aCol2 As New DataGridTextBox Column()
Dim aCol3 As New DataGridTextBox Column()
With aCol1
.MappingName = "ID"
.Width = 0
End With
With aCol2
.MappingName = "Contact"
.HeaderText = "Contact"
.Width = 65
.Alignment = HorizontalAlign ment.Left
.TextBox.Enable d = False
End With
With aCol3
. MappingName = "Company"
.HeaderText = "Company"
.Width = 50
.Alignment = HorizontalAlign ment.Center
.NullText = ""
.TextBox.Enable d = True
End With
With aGridTableStyle .GridColumnStyl es
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
End With
dgdContracts.Ta bleStyles.Add(a GridTableStyle)
If dsContracts.Tab les(0).Rows.Cou nt > 0 Then
With dgdContracts
.DataSource = dsContracts.Tab les(0)
.Expand(-1)
.NavigateTo(0, "Contracts" )
End With
End If
End Sub


Nov 20 '05 #4
I`ve sorted it it needed aGridTableStyle .MappingName

Judt gotta get the colour working now:(

Cheers For all you help
Ta
Si

"Newbie!" <s_************ @yahoo.co.uk> wrote in message
news:-k************** ******@karoo.co .uk...
Thanks for your reply,
When i add:

.MappingName = dsContracts.Tab les(0).TableNam e

I get an error saying D:\Excellence.N ET\Contracts.vb (462): 'MappingName' is not a member of 'System.Windows .Forms.GridColu mnStylesCollect ion'.

I guess i need to add something else but i don`t know what

Thanks again for you help so far,

Ta
Si

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:uh******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,

Before you add the tablestyle to the grid you need to set its
mapping name.

With aGridTableStyle .GridColumnStyl es
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
.MappingName = dsContracts.Tab les(0).TableNam e
End With
Ken
---------------------
"Newbie!" <s_************ @yahoo.co.uk> wrote in message
news:O0******** ************@ka roo.co.uk...
Hi Group,

Im trying to Format some coloums on my Datagrid so that only 3 Coloums are show out of the 20 in my Dataset, I just carn`t for the life of me get it to
work, i`ve looked everywhere for info but with no joy. Does anybody have any
example code links? or even better project links? here is my following
Code
if anybody can help me with this please

Many thanks
Si

Private Sub frmContracts_Lo ad(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
If odcContracts.St ate <> ConnectionState .Open Then odcContracts.Op en() odaContracts.Fi ll(dsContracts)
Dim aGridTableStyle As New DataGridTableSt yle()
aGridTableStyle .MappingName = "mapcontrac ts"
Dim aCol1 As New DataGridTextBox Column()
Dim aCol2 As New DataGridTextBox Column()
Dim aCol3 As New DataGridTextBox Column()
With aCol1
.MappingName = "ID"
.Width = 0
End With
With aCol2
.MappingName = "Contact"
.HeaderText = "Contact"
.Width = 65
.Alignment = HorizontalAlign ment.Left
.TextBox.Enable d = False
End With
With aCol3
. MappingName = "Company"
.HeaderText = "Company"
.Width = 50
.Alignment = HorizontalAlign ment.Center
.NullText = ""
.TextBox.Enable d = True
End With
With aGridTableStyle .GridColumnStyl es
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
End With
dgdContracts.Ta bleStyles.Add(a GridTableStyle)
If dsContracts.Tab les(0).Rows.Cou nt > 0 Then
With dgdContracts
.DataSource = dsContracts.Tab les(0)
.Expand(-1)
.NavigateTo(0, "Contracts" )
End With
End If
End Sub



Nov 20 '05 #5
better than col.width = 0

table.Columns(x xxx).ColumnMapp ing = MappingType.Hid den
Dominique

"Newbie!" <s_************ @yahoo.co.uk> wrote in message
news:O0******** ************@ka roo.co.uk...
Hi Group,

Im trying to Format some coloums on my Datagrid so that only 3 Coloums are
show out of the 20 in my Dataset, I just carn`t for the life of me get it to work, i`ve looked everywhere for info but with no joy. Does anybody have any example code links? or even better project links? here is my following Code if anybody can help me with this please

Many thanks
Si

Private Sub frmContracts_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If odcContracts.St ate <> ConnectionState .Open Then odcContracts.Op en()
odaContracts.Fi ll(dsContracts)
Dim aGridTableStyle As New DataGridTableSt yle()
aGridTableStyle .MappingName = "mapcontrac ts"
Dim aCol1 As New DataGridTextBox Column()
Dim aCol2 As New DataGridTextBox Column()
Dim aCol3 As New DataGridTextBox Column()
With aCol1
.MappingName = "ID"
.Width = 0
End With
With aCol2
.MappingName = "Contact"
.HeaderText = "Contact"
.Width = 65
.Alignment = HorizontalAlign ment.Left
.TextBox.Enable d = False
End With
With aCol3
. MappingName = "Company"
.HeaderText = "Company"
.Width = 50
.Alignment = HorizontalAlign ment.Center
.NullText = ""
.TextBox.Enable d = True
End With
With aGridTableStyle .GridColumnStyl es
.Add(aCol1)
.Add(aCol2)
.Add(aCol3)
End With
dgdContracts.Ta bleStyles.Add(a GridTableStyle)
If dsContracts.Tab les(0).Rows.Cou nt > 0 Then
With dgdContracts
.DataSource = dsContracts.Tab les(0)
.Expand(-1)
.NavigateTo(0, "Contracts" )
End With
End If
End Sub

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4544
by: spoilsport | last post by:
Ive got to write a multi-function program and I'm plugging in the functions but I keep getting this error from line 40. Im new to this and cant find an answer anywhere. Sam #include <stdio.h> int main (void)
4
1470
by: Corey Dyke | last post by:
K here's what happened. For my English project at DeVry, I had to design a website for a company of my choice. So since my dad has been after me for years to do one for him, I decided to finally do it. So I decided to do most of the pages in HTML, which i'll be doing soon. And since he's a Flooring Contractor, I decided to do an Estimate Sheet page in ASP. I've done C# courses and never had any problems with the programming aspect, but...
4
4778
by: Martin Odhelius | last post by:
Hello, I have a very fustrating problems while debugging ASP.NET applications. When I am debugging and stepping thru code (with F10 or F11) Visual Studio some times suddenly just stop responding and the only way get it up and running again is to kill the aspnet_wp.exe process. When the debugger hangs there is almost no CPU load, so it doesn't seem to be any hidden eternal loop or anything like that. I have tried to reinstall IIS and...
33
2850
by: Martin Jørgensen | last post by:
Hi, In continuation of the thread I made "perhaps a stack problem? Long calculations - strange error?", I think I now got a "stable" error, meaning that the error always seem to come here now (tried: visual studio 2005 + linux/macintosh gcc)... That's a pretty good thing. I think the error still appears using both gcc and visual studio 2005. Everything is standard C (ANSI C ?? I don't know the difference) - but since so many functions...
6
2204
by: thomas.luce | last post by:
Okay, I have been programming for a long time, and am getting back into C after about a 4 year break from it. Below is some code that won't compile for the life of me, and it is driving me crazy! If anyone can see anything that I can't, I would love to know. All the code is pasted, although in my real code it is broken into a header and a seperate .c file. #include <stdlib.h> typedef enum {typeNum, typeString} VariableType;
11
2447
by: shapper | last post by:
Hello, I am creating a centered web site with various div's inside the main (pBase) div. Somehow, I am getting a gap on the top of my browser window both in IE and Firefox. I tried everything I could think of. Here is my entire HTML code:
9
6532
by: ckfan.painter | last post by:
I've run into a seemingly bizarre problem with insert() for std::vector. (This was done on Microsoft Visual C++ 2005 express version 8...maybe it is a compiler specific bug?) Here's the code: //=================== // vector tester 3.cpp : main project file.
0
2880
by: Teo | last post by:
Hi!! I have been trying to fix an error I keep getting on my VB.NET code. For some reason, I get an error saying "Invalid attempt to access a field before calling Read()" everytime. As you can see in my code below, I created the connection, connection string, etc and I opened the connection, executed the reader and then called the datareader.read() before any variable assignment below. I keep getting that error and I don't know why! I am...
1
2662
by: shapper | last post by:
Hello, On my CMS I am signed as administrator and I am creating a Membership user and its profile: MembershipCreateStatus status; MembershipUser user = Membership.CreateUser("Joe", "Pass", "Joe@email.com", null, null, true, null, out status); if (user != null) { ProfileHelper profile =
0
8376
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
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,...
0
8708
jinu1996
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...
0
8594
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.