Question Forward & Back Navigation

tqmd1

Well-known member
Joined
Dec 5, 2009
Messages
60
Programming Experience
Beginner
Dear Experts

I developed a simple project.
The attachment contains one form and a database.

This work fine

But I need source codes for NEXT and BACK buttons

Please unzip and help
 
Last edited by a moderator:
I have removed your attachment as, judging by the size, it almost certainly contained binary files. I apologise if it didn't but it's unlikely that a ZIP file over 1 MB contained only source code. Please remove all binary files from your project, i.e. delete at least the 'bin' and 'obj' folders before zipping your project.

It's also unlikely that many people are going to want to trawl through an entire project to work out what you might want. Uploading entire projects should be a last resort. The first option should be your explaining to us, fully and clearly, what you want to do, what you're currently doing (which includes ONLY the relevant code) and EXACTLY what the problem is.
 
Dear jmcilhinney

I told everthing in details in my thread that I need codes for navigation.

If you are unable to understand my question then what is my sin?

I suggest you understand read between lines.

It is Very Bad that you removed my attachment.
May that was usefull for some others.

But do not fear, I will not re upload it.
 
I think your looking for this :

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Debug.Print(e.KeyValue.ToString)
End Sub

The next key produces a 176
the prev key produces a 177

on a microsoft keyboard 6000 series
 
Dear Sir,

I did not really want that.

If you want to help me then I could you my navigation problem.

Please reply
 
tqmd1, you have yet to begin to explain what navigation you're talking about, obviously the keyboard's Next/Prev buttons isn't it, are you talking about the mouses Next/Prev buttons? A web browser's Next/Prev navigation in the toolbar? Is there some other type of navigation you're talking about?
 
Dear SIR,
I am using following codes for navigation. it works fine But I do not need it.
In these codes the base of navigation is listview as
VB.NET:
 Dim SelectedIndex = ListView1.SelectedItems(0).Index
But I want navigation based on textbox1
Suppose there is 2 in textbox1, by pressing nextbutton it must display nextrecord that is 3.
I am attaching only form. Please review and help

VB.NET:
 Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click

        If ListView1.SelectedItems.Count <> 0 Then
            Dim SelectedIndex = ListView1.SelectedItems(0).Index
            If SelectedIndex = ListView1.Items.Count - 1 Then
                Call SelectItem(ListView1, 0)
            Else
                Call SelectItem(ListView1, SelectedIndex + 1)
            End If
        Else
            Call SelectItem(ListView1, 0)
        End If

    End Sub

    Private Sub cmdBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBack.Click

        If ListView1.SelectedItems.Count <> 0 Then
            Dim SelectedIndex = ListView1.SelectedItems(0).Index
            If SelectedIndex = 0 Then
                Call SelectItem(ListView1, ListView1.Items.Count - 1)
            Else
                Call SelectItem(ListView1, SelectedIndex - 1)
            End If
        Else
            Call SelectItem(ListView1, 0)
        End If

    End Sub
    Private Sub SelectItem(ByRef TargetListview As ListView, ByVal Index As Integer)
        TargetListview.SelectedItems.Clear()
        TargetListview.Items(Index).Selected = True
    End Sub
 

Attachments

  • Navigation.zip
    282.7 KB · Views: 16
Last edited by a moderator:
Hi

I have readed your post over 10 times now. I am not sure if I understand right. Perhaps you have to follow the instructuions of the moderator, remove all unnessecary folders and put the database in the zip file.

If I understand right, after pressing the "back" button, you have to include the methode
VB.NET:
grd1_CellEnter(nothing, nothing)
to update the data in the GUI.

Regards
Timo
 
I am sorry that no body could still understand the meanings of following lines

I am using following codes for navigation. it works fine But I do not need it.
In these codes the base of navigation is listview as
VB.NET:
 Dim SelectedIndex = ListView1.SelectedItems(0).IndexBut I want navigation based on textbox1
Suppose there is 2 in textbox1, by pressing nextbutton it must display nextrecord that is 3.
I am attaching only form. Please review and help
 
My take on it is:
VB.NET:
Dim indx As Integer
If Textbox1.Text.Trim <> String.Empty AndAlso Integer.TryParse(Textbox1.Text.Trim, indx) Then
    ListView1.SelectedIndecies.Clear
    ListView1.SelectedIndecies.Add(indx)
End If
 
Dear Sir,

My all efforts have failed to tell what result I want to get.
No matter, here is another method to descrieb my question.

Table employess has data look this this

sno-----name-----city
1---------A--------X
2---------B--------Y
4---------D--------M

Now there are THREE textboxes on form
I have following codes on the LOSTFOCUS of Textbox1

VB.NET:
 If Len(Me.TextBox1.Text) > 0 Then
            str2 = "select * from employees where sno =" & Val(Me.TextBox1.Text)
            cmd2 = New SqlClient.SqlCommand(str2, con)
            da2 = New SqlClient.SqlDataAdapter(cmd2)
            dt2 = New DataTable
            da2.Fill(dt2)

            If (dt2.Rows.Count >= 1) Then
                Me.TextBox2.Text = dt2.Rows(0)("name")
                Me.TextBox3.Text = dt2.Rows(0)("city")
            Else
                Me.TextBox2.Text = ""
                Me.TextBox3.Text = ""
            End If

        End If

Textbox1 has sno=2
so data in other textboxes displays as

textbox2=B
textbox3=Y

Now actual point......

How to display Next Record while pressing Next Button

What codes should I needed?

After pressing Next Button, the data in textboxes must display as

textbox1=4
textbox2=D
textbox3=M

I think this is a very simple method to describe Question.

Please help
 
DEAR sir,
VB.NET:
I found following codes in your given link
Dim bm as BindingManagerBase
Dim da As New SqlDataAdapter("Select urcolumn_name from urtableName", "server=urservername;Database=urdatabasename;UserId=Uruserid;Pwd=urpassword")
Dim ds As New DataSet
da.Fill(ds)
bm = Me.BindingContext(ds, "authors") 
dr = ds.Tables(0).Rows(ds.Tables(0).Rows.Count - 1)
UrTextBoxId.Text = dr(0)
Due to some tecninal reasons, I do not want to use BINDINGCONTEXt
Please suggest some other method
 
Back
Top