单击Form1上的showDetails按钮时,Form2上dataGridView中的选择与Form1上的listBox1相同. [英] selection in dataGridView on Form2 shows the same as listBox1 on Form1 when showDetails button on Form1 is clicked.

查看:72
本文介绍了单击Form1上的showDetails按钮时,Form2上dataGridView中的选择与Form1上的listBox1相同.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个电影的Access数据库.我正在创建Windows窗体应用程序.所有列和行均显示在Form2上的dataGridView中.在Form1上,有一个listBox仅显示影片名称. Form1上还有一个按钮.我想从列表框中选择一个电影名称,然后单击按钮,然后Form2应该弹出(它确实要这样做),并且应该在dataGridView中选择该电影的记录(行),而我不这样做.不必滚动列出的800部以上电影即可找到它.

有什么想法吗?


谢谢,
dirk

I have an Access database of movies. I am creating a Windows Form Application. All the columns and rows show in the dataGridView on Form2. On Form1 there is a listBox that shows only the movie name. There is also a button on Form1. I want to select a movie name from the listBox and click the button and Form2 should pop up(which it does)and the record(row) for that movie should be selected in the dataGridView(which it doesn''t) so I do not have to scroll through 800+ movies listed to find it.

Any thoughts?


thanks,
dirk

推荐答案

查看DataGridView.Rows [index] .Selected属性:MSDN [ MSDN [
Look at DataGridView.Rows[index].Selected property: MSDN[^].

To make sure a row is scrolled into the display, set the DataGridView.CurrentCell property: MSDN[^]


这篇关于单击Form1上的showDetails按钮时,Form2上dataGridView中的选择与Form1上的listBox1相同.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆