代码如下:
1
using
System;
2
using
System.Collections.Generic;
3
using
System.ComponentModel;
4
using
System.Drawing;
5
using
System.Data;
6
using
System.Text;
7
using
System.Windows.Forms;
8
using
Traffic_SQLDAL;
9
using
Traffic_SQLDAL.TrafficDSTableAdapters;
10
using
Traffic_BLL;
11
using
Traffic_Model;
12
13
namespace
WinControlLib
14
{
15
public partial class UserControl3 : UserControl
16
{
17
BindingManagerBase bManager;
18
public UserControl3()
19
{
20
InitializeComponent();
21
22
23
24
List<MapIconHistoryInfo> infos = MapIconHistoryBLL.J_M_GetHistotyNoteByMapIconID(13);
25
26
//数据源用infos ********************************************
27
//textBox1.DataBindings.Add("Text", infos, "ID");
28
//textBox2.DataBindings.Add("Text", infos, "Deadline");
29
30
//bManager = this.BindingContext[infos];
31
32
//*******************************************************
33
//数据源用 bindingSource1
34
this.bindingSource1.DataSource = infos;
35
textBox1.DataBindings.Add("Text", bindingSource1, "ID");
36
textBox2.DataBindings.Add("Text", bindingSource1, "Deadline");
37
38
bManager = this.BindingContext[bindingSource1];
39
}
40
41
private void button1_Click(object sender, EventArgs e)
42
{
43
bManager.Position -= 1;
44
}
45
46
private void button2_Click(object sender, EventArgs e)
47
{
48
bManager.Position += 1;
49
}
50
}
51
}
52
53

2

3

4

5

6

7

8

9

10

11

12

13

14



15

16



17

18

19



20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42



43

44

45

46

47



48

49

50

51

52

53

运行效果: