如何使用Visual Basic在POS软件中创建并显示客户屏幕

huangapple go评论60阅读模式
英文:

How to create and show a customer screen in a POS software using visual basic

问题

我正在使用Visual Basic构建POS软件,尝试在客户面向屏幕上显示客户屏幕。

使用的设备是
APT 200系列 - 触摸屏POS

我已经创建了一个客户表单,并在主表单的加载事件中使用了以下代码:

Dim secondaryDisplay As Screen = Screen.AllScreens(1)

'为辅助显示创建一个新窗体
Dim customerscreen As New Form()

'将窗体属性设置为在辅助显示上显示
customerscreen.StartPosition = FormStartPosition.Manual
customerscreen.Location = secondaryDisplay.Bounds.Location
customerscreen.WindowState = FormWindowState.Maximized
customerscreen.FormBorderStyle = FormBorderStyle.None

'在辅助显示上显示窗体
customerscreen.Show()

但在以下行中显示以下错误:

Dim secondaryDisplay As Screen = Screen.AllScreens(1)

索引超出了数组的界限。

有人可以帮忙吗?

英文:

I am building a POS software using visual basic and trying to display the customer screen on the customer facing screen.

device used is
APT 200 series - touch screen POS

i have created a customer form and used the following code in the main form load event

        Dim secondaryDisplay As Screen = Screen.AllScreens(1)

        'Create a new form for the secondary display
        Dim customerscreen As New Form()

        'Set the form's properties to display on the secondary display
        customerscreen.StartPosition = FormStartPosition.Manual
        customerscreen.Location = secondaryDisplay.Bounds.Location
        customerscreen.WindowState = FormWindowState.Maximized
        customerscreen.FormBorderStyle = FormBorderStyle.None

        'Show the form on the secondary display
        customerscreen.Show()

but showing the following error in the following line

Dim secondaryDisplay As Screen = Screen.AllScreens(1)

Index was outside the bounds of the array.

can anyone help on this

答案1

得分: 3

这意味着它没有检测到辅助监视器。返回的数组只包含1个监视器。这就是为什么出现 Index was outside the bounds of the array 错误。

我建议在尝试获取第二个屏幕之前检查数组的长度。
如果数组只包含1个项目,那意味着你无法选择第二个屏幕的值。

英文:

It means that it does not detect a secondary monitor. The array returned contains only 1 monitor. That is why you have the Index was outside the bounds of the array. error.

I suggest you to check the length of the array before trying to get the second screen.
If the array contains only 1 item, that means you can't pick a second screen value.

huangapple
  • 本文由 发表于 2023年5月8日 00:07:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76194976.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定