You need to use a timer.
but i need coding from begining of a sub as i am not able to iterate my database values.
Can you be so kind to post what you coded so far?
This is my code
Public Const cnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:\customer.mdb" ssql = "SELECT c_name, address FROM detail" Dim cnCustomers As OleDbConnection Dim sqlCmd As OleDbCommand = New OleDbCommand(ssql) Dim myData As OleDbDataReader cnCustomers = New OleDbConnection(cnString) cnCustomers.Open() sqlCmd.Connection = cnCustomers myData = sqlCmd.ExecuteReader Dim strValue As String Do While myData.Read strValue = IIf(myData.IsDBNull(0), "", myData.GetValue(0)) ' CButton27.Text = strValue For shtCntr = 1 To myData.FieldCount() - 1 If myData.IsDBNull(shtCntr) Then Else CButton27.Text = strValue CButton28.Text = (myData.GetString(shtCntr)) End If Next shtCntr Loop myData.Close() cnCustomers.Close()
but not able to display value after particular interval
Before you start reading data you'll need a timer
Dim WithWEvents ReaderTimer as Timer = new Timer
In order to define a withevents timer, you must do so on the class level.
Then, in this sub, initialize it to 5 seconds interval.
ReaderTimer.Interval=5000 ' In thousands of seconds
And Start the timer
Also, you'll need a interval read permission like
Dim CanRead as Boolean = Flase
to be defined in this sub.
Then, before the Loop sentence you should add
Do Application.Doevents() Loop Until CanRead CanRead = False
This will put the application in a wait state until the timer is fired.
Before the myData.Close() you should stop the timer with
In order to catch the Tick event from the ReaderTimer you should create a new sub
Sub RederTimer_Tic(myObject As Object, _ ByVal myEventArgs As EventArgs) Handles ReaderTimer.Tick CanRead = True End Sub
None of this code has been tested, but I hope this helps
can you just use
or something like that?
@lolafuertes:- i am not able to get you please elaborate.
@phoenix911 :- the whole application get into sleep mode
i want when user press a button1, data load onto my button2 text from database and data automatically get refresh after 30 sec.
On your first post, I understood to ahow every five seconds to show a row.
On your last one, are you saying every 30 the hole database info?
What is unclear for you?
I think I described, every sentence and the exact place to put each, all what you need to do modify the piece of code you wrote here.
Please le us know
i think this will helps you , i dont know much about dealing with access so here is code for mssql to perform same function which u want
dim con as new sqlconnection("connection string") con.open() dim da as new sqldataadapter("ur sql command",con) dim dt as new datatable da.fill(dt) 'now take a bindingsource control bindingsource1.datasource= dt textbox1.DataBindings .Add ("text",bindingsource1,"Field name",false) textbox2.DataBindings .Add ("text",bindingsource1,"Field name",false)
after this place a timer control and set interval according to your requirement .1000 = 1 sec
now place this code on timers tick event before this , you have to declare a variable name i on the top as a global variable datatype int
i = i+1 bindingsource1.position = bindingsource.position + 1
this code will change the position of the bindingsource after each tick , and the values of your textboxes will also changed .
Hope this will helps you
Hi i got it.
thanx guys !!
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.
This is the result of previous question answered :
code for the listbox - datagridview interaction
At the top of the code ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...