473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Help with data grid



Can someone please help me? I am still learning vb so this is fairly
new.

I have been chasing this problem for 3 days now and I think that I am
ready to give up. Does anyone know how to make my data grid display on
a tab control? I have a tab control with 2 tabs on it, one for the
data grid and the other for comments. I have tried everything. Where
do I add the code to say display the data grid on this tab? I have the
code and everything working to fill the data adapter and fill the data
grid from the table but I don't know how to make it display on the tab
control. This is driving me crazy, help...thanks

this is my code for the data adapter:

Dim strOTRConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source= C:\otr.mdb"
Dim strSQLEpisode As String
Dim dtEpisode As New DataTable
Dim dgEpisodes As New DataGrid

dtEpisode.Clear()
strSQLEpisode = "SELECT * " & _
"FROM Episode WHERE showcode = '" & Me.txtCode.Text & "' "
Dim dataAdapter As New OleDb.OleDbDataAdapter (strSQLEpisode,
strOTRConnection)
dataAdapter.Fill(dtEpisode)
dataAdapter.Dispose()
Me.dgEpisodes.DataSource = dtEpisode
As you can see, I handled everything in code so I did not build a
dataset or used any tools. Just added everything to connect the data
adapter in code.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
12 1437
Hi,

Are you sure you are getting any data into the datatable ?
Debug.Writeline(dtEpisode.Rows.Count) will tell you how many rows are being
returned.

Ken
------------
"Kimberley Wiggins" <ki********@greenwaymedical.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...


Can someone please help me? I am still learning vb so this is fairly
new.

I have been chasing this problem for 3 days now and I think that I am
ready to give up. Does anyone know how to make my data grid display on
a tab control? I have a tab control with 2 tabs on it, one for the
data grid and the other for comments. I have tried everything. Where
do I add the code to say display the data grid on this tab? I have the
code and everything working to fill the data adapter and fill the data
grid from the table but I don't know how to make it display on the tab
control. This is driving me crazy, help...thanks

this is my code for the data adapter:

Dim strOTRConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source= C:\otr.mdb"
Dim strSQLEpisode As String
Dim dtEpisode As New DataTable
Dim dgEpisodes As New DataGrid

dtEpisode.Clear()
strSQLEpisode = "SELECT * " & _
"FROM Episode WHERE showcode = '" & Me.txtCode.Text & "' "
Dim dataAdapter As New OleDb.OleDbDataAdapter (strSQLEpisode,
strOTRConnection)
dataAdapter.Fill(dtEpisode)
dataAdapter.Dispose()
Me.dgEpisodes.DataSource = dtEpisode
As you can see, I handled everything in code so I did not build a
dataset or used any tools. Just added everything to connect the data
adapter in code.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2

Yes I did try that and it does show that I am getting the correct rows
into the datatable.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3
Cor
Hi Kimberly,

It is strange becaus I tested your code (with another database) and it
showed a datagrid .

But I had nothing to add to Kens question, because mine would have been the
same.

But now my next question, is the datagrid showed (empty)?

Cor
Yes I did try that and it does show that I am getting the correct rows
into the datatable.

Nov 20 '05 #4
Yes, I finally got the datagrid to display but it is displaying empty.
I would think that it would just display by the code that is in the
leading tables records but I guess not. I had it to fill the data
adapter and it is pointing to the correct table. Do you know what could
be wrong?
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5
Cor
Hi Kimberley,

You say finaly, you are sure it is the same datagrid?
(The same name dgEpisodes)

Cor
Nov 20 '05 #6
Yes you were right, I was looking at the wrong grid. It is not pulling
back any records. It is something in my select statement. When I try
this:

strSQLEpisode = "SELECT * from episode"

it pulls back all 9024 records. But when I try this:

strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode = '" & Me.txtCode.Text & "' "

it pulls back 0. Can you see anything wrong with this statment? The
text box that it is getting the showcode column from is populating is
there is no reason why it should not drive off of that.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #7
Hi,

Try this.

strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode LIKE '" & Me.txtCode.Text & "%' "

Ken
------------------
"Kimberley Wiggins" <ki********@greenwaymedical.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Yes you were right, I was looking at the wrong grid. It is not pulling
back any records. It is something in my select statement. When I try
this:

strSQLEpisode = "SELECT * from episode"

it pulls back all 9024 records. But when I try this:

strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode = '" & Me.txtCode.Text & "' "

it pulls back 0. Can you see anything wrong with this statment? The
text box that it is getting the showcode column from is populating is
there is no reason why it should not drive off of that.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #8
Cor
Kimberley,

No I see nothing.
strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode = '" & Trim(Me.txtCode.Text) & "' "


But in my opinion that cannot be the error.

You are shure you fill in a good value?

Cor
Nov 20 '05 #9

I found what the problem was. The text field name that is driving what
will display in the data grid keep having a record that I entered
through my add code. I now need to figure out why that is the record it
is always going back to when I start the program instead of back to the
beginning of the file. Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #10

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

Try this.

strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode LIKE '" & Me.txtCode.Text & "%' "

^^ Perhaps a space after the episode or before the from would help?

-CJ
Ken
------------------
"Kimberley Wiggins" <ki********@greenwaymedical.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Yes you were right, I was looking at the wrong grid. It is not pulling
back any records. It is something in my select statement. When I try
this:

strSQLEpisode = "SELECT * from episode"

it pulls back all 9024 records. But when I try this:

strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode = '" & Me.txtCode.Text & "' "

it pulls back 0. Can you see anything wrong with this statment? The
text box that it is getting the showcode column from is populating is
there is no reason why it should not drive off of that.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 20 '05 #11
meh
Hi all;

Sorry if I've missed something....I'm coming into this late.....but....

Sould I assume that episode and Episode are 2 different tables in this
database????

meh

"Cor" <no*@non.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
Kimberley,

No I see nothing.
strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode = '" & Trim(Me.txtCode.Text) & "' "


But in my opinion that cannot be the error.

You are shure you fill in a good value?

Cor

Nov 20 '05 #12
Good eye

Ken
----------
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

Try this.

strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode LIKE '" & Me.txtCode.Text & "%' "


^^ Perhaps a space after the episode or before the from would help?

-CJ
Ken
------------------
"Kimberley Wiggins" <ki********@greenwaymedical.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Yes you were right, I was looking at the wrong grid. It is not pulling back any records. It is something in my select statement. When I try
this:

strSQLEpisode = "SELECT * from episode"

it pulls back all 9024 records. But when I try this:

strSQLEpisode = "SELECT * from episode" & _
"FROM Episode WHERE showcode = '" & Me.txtCode.Text & "' "

it pulls back 0. Can you see anything wrong with this statment? The
text box that it is getting the showcode column from is populating is
there is no reason why it should not drive off of that.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Nov 20 '05 #13

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

Similar topics

2
by: Jordan O'Hare | last post by:
Hello Everyone, I am after some help with the following: I have a windows application that contains a list box and two data grids. All three controls are binded to a dataset that contains...
2
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element?...
0
by: sunilkumar Reddy via DotNetMonster.com | last post by:
hai all first we can take binded grid Export to excel data from ultrawebgrid (or) datagrid rows, Each row data Expoting to one worksheet in excel workbook, like as grid row1 data contain sheet1...
1
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
0
by: BigAl.NZ | last post by:
Hi Guys, I am trying to write/copy some code that uses events with a GPS. Everytime the GPS position updates the event fires. The GPS code is from a SDK Library that I got called GPS Tools...
2
by: sicapitan | last post by:
I'm trying to build some xml from an array with the help from another array. In one array I have $cells Array ( =CELL0
9
by: trint | last post by:
How can I retrieve all of the data from a datagridview? Any help is appreciated. Thanks, Trint
6
by: Simon Harvey | last post by:
Hi all, I'm really hoping someone can help me with this as it's causing me some serious problems. I have a Windows Forms application using the gridview control. When the user selects a row,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...
0
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...
0
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,...
0
isladogs
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...

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.