Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / May 2006

Tip: Looking for answers? Try searching our database.

Accessing SQL dataset value from button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nomail.thanks@gmail.com - 07 May 2006 20:41 GMT
I apologize for the question in advance.  I have lots of experience
with lots of other languages, but now I'm trying to accomplish
something with VB.NET Express.  My experience with VB.NET express is
less than a week.  I've gone through what appear to be the relevant
tutorials that came with the product, consulted the two reference books
I have, explored the source code that is being generated by my project,
and played around trying various things for about a day and a half now,
and since I'm sure there is a simple solution to what I am trying to
accomplish, I decided the time has come to just ask the experts.

I've built my SQL database, and VB.NET is connecting to it just fine,
displaying the value of each row as details.  The form which is
displaying the data also has a couple of buttons, and when I click on a
button, I want to pass the values being displayed in the form's text
fields to an external subroutine.  The call to the subroutine is going
just fine, and I can pass constants to it, but I'm having trouble
figuring out how to get the data values I want out of the text fields.

Let's say my database is called MyDatabase, the table I'm accessing is
MyTable1, and the column I want to pass is Name.  How do I get the
currently-displayed value of "Name" into a variable I can pass to a
subroutine?  Or, even better, what is the variable that already
contains this value in VB.NET Express?  Thanks in advance to anyone who
can provide a solution.
nomail.thanks@gmail.com - 07 May 2006 22:37 GMT
Okay, by my count, seven people who knew the answer have already read
this question and deemed it too simple to respond to.  After trying all
kinds of Me.MyTable1.TableAdapter.Getdata.Namecolumn variations, I
finally saw that a simple NameTextBox.Text had the value I wanted.
Thanks anyway; kudos to me.
james - 07 May 2006 23:32 GMT
Kudos to you!!  :-)
Did you ever stop to think that maybe, those seven people that you say read
the post and knew the answer, may not have?
I read lots of posts in newsgroups but, that doesn't mean I know the answers
to every one of them. And , after re-reading your original post, there was
nothing there that would have helped anyone know that a simple
"NameTextBox.Text"  had the value you were looking for. You didn't post any
of your code to help others help you. Not knowing what you had done so far,
(code wise) makes it hard to offer constructive suggestions or solutions.
Don't give up on asking for help when you need it. But, try to post some of
the code you are working with so if there is a simple solution, it might be
easier for others to help you find.
james

> Okay, by my count, seven people who knew the answer have already read
> this question and deemed it too simple to respond to.  After trying all
> kinds of Me.MyTable1.TableAdapter.Getdata.Namecolumn variations, I
> finally saw that a simple NameTextBox.Text had the value I wanted.
> Thanks anyway; kudos to me.
nomail.thanks@gmail.com - 08 May 2006 00:05 GMT
Hey, I appreciate the feedback.  The "seven people" was obviously a
joke, but I figure pretty much everyone on this newsgroup knows more
than I do, and thought somebody who knew the answer had probably moved
on to a more challenging problem without responding.  From what you're
saying, maybe I was wrong.

As I say, I'm new to VB, and actually new to IDEs as well.  Since the
pieces are all over the place, I didn't think posting my code would
help.  The code I have in my View Code window just has the Form1 code
-- 3 private subroutines, one for Form1_Load, one for
TableBindingSaveNavigator_Click, and one for my Button1_Click.  My
solution is there now in Button1_Click, but I hardly think that posting
what was there before would have been any more help than the
description of the problem I posted initially.  Maybe I'm wrong about
that too.

Anyway, I do appreciate the feedback.  Hopefully, the next time I need
help, I'll know enough to have a better idea of how to ask for it.
Cor Ligthert [MVP] - 08 May 2006 07:19 GMT
Keep in mind, that although this is a 24 hours newsgroup, is it in the
weekend less active than during working days.

As well is in my opinion your text by trying to describe everything not very
clear what you really want..

How can I put the value 1 in whatever textbox would have given you many of
these kind of answers.

MyTextbox.Text = "1"

or asking "how can I get the Text of a textbox in a string" would have been

dim myfield as string = myTextBox.Text

Now we probably all had the idea that it was an adonet question.

I hope this helps,

Cor

> Okay, by my count, seven people who knew the answer have already read
> this question and deemed it too simple to respond to.  After trying all
> kinds of Me.MyTable1.TableAdapter.Getdata.Namecolumn variations, I
> finally saw that a simple NameTextBox.Text had the value I wanted.
> Thanks anyway; kudos to me.
Cor Ligthert [MVP] - 08 May 2006 07:10 GMT
Nomail,

The biggest problem using Net is learn not to use your old methods anymore.

The most simple way to access data using Net is using the designers. They
are not often sufficient, however they have reached a stadium that it is
good to do.

Try this one, and know that all the code that is generated is viewable for
you by clicking in the solution explorer "show all files"

http://www.vb-tips.com/default.aspx?ID=1139f14a-c236-4ad7-8882-b1ed16424252

I hope this helps,

Cor

>I apologize for the question in advance.  I have lots of experience
> with lots of other languages, but now I'm trying to accomplish
[quoted text clipped - 20 lines]
> contains this value in VB.NET Express?  Thanks in advance to anyone who
> can provide a solution.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.