2 Replies - 352 Views - Last Post: 14 April 2013 - 03:38 AM Rate Topic: -----

#1 ansumariyam88  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 04-April 13

How to display the values from ms acess to the next or another form?

Posted 08 April 2013 - 09:39 PM

Please find the attached code,this much coding i done....after this what will i do?please help...

ImportsSystem.Data.OleDb
PublicClassList
DimcmdAsNewOleDbCommand
DimrdrAsOleDbDataReader
DimstrmsgAsString
DimdbAsNewmydb1
Dim da AsNewOleDbDataAdapter
DimdsetAsNewDataSet


PrivateSubList_Load(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs) HandlesMyBase.Load
db.dbconnection()

strmsg = "select class from list"
'con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\user\Documents\Visual Studio 2010\Projects\ANSU\WindowsApplication1\bin\informatics.accdb"
'con.Open()
cmd = db.dbcommand(strmsg)
rdr = cmd.ExecuteReader
Whilerdr.Read
ComClass1.Items.Add(rdr.Item("class"))

EndWhile
rdr.Close()
EndSub

PrivateSub TextBox1_TextChanged(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs) HandlestxtTeacher.TextChanged

EndSub

PrivateSub ComClass1_SelectedIndexChanged(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs) Handles ComClass1.SelectedIndexChanged
cmd.CommandText = "select * from list where class = '"& ComClass1.Text.ToString &"' "
rdr = cmd.ExecuteReader
rdr.Read()
txtTeacher.Text = rdr.Item("teachNme")

rdr.Close()

EndSub

PrivateSub Button1_Click(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
cmd.CommandText = "select studNme from List where class = '"& ComClass1.Text.ToString &"' "
'cmd.Parameters.AddWithValue(" & ComClass1.Text.ToString & ", Text.ToString)
Ifrdr.HasRowsThen
MsgBox(rdr(" & ComClass1.Text.ToString & "))

EndIf
rdr = cmd.ExecuteReader

EndSub
EndClass


This post has been edited by Martyr2: 08 April 2013 - 10:28 PM
Reason for edit:: Please use code tags in the future, thanks! :)


Is This A Good Question/Topic? 0
  • +

Replies To: How to display the values from ms acess to the next or another form?

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4318
  • View blog
  • Posts: 12,100
  • Joined: 18-April 07

Re: How to display the values from ms acess to the next or another form?

Posted 08 April 2013 - 10:32 PM

For starters you might want to add some spacing to some of your keywords. It is not "EndClass" it is "End Class". I am not sure if it is the result of your paste or not but the spacing in these keywords are important.

As for populating other forms, remember they are classes and so you can call methods on those forms. Those methods can see a form's controls. This should give you the idea that one form can call another form's method which manipulates controls on that form. It is one way of passing data.
Was This Post Helpful? 0
  • +
  • -

#3 ansumariyam88  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 04-April 13

Re: How to display the values from ms acess to the next or another form?

Posted 14 April 2013 - 03:38 AM

i need to display the values from the table to the second form when i button click to the first form?how i do this?the above code much i do so far
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1