I'm trying to fix a problem with a program SetDesktopLocation
settings.
Previously, the program is on a dual-monitor PC setup, with the 1st monitor resolution being 1280 x 720. The program's configuration settings are all in a notepad file, which includes refresh time, connection string, and the X-position Xpos
set to 1280. So that the program will open on the 2nd monitor/TV.
But after a few weeks of inactivity and a change of cable to connect the TV, the program keeps opening to the monitor instead. Everything in the config file is working, just except for the Xpos
only. I even check back my code to make sure nothing's wrong, but can't find anything off.
Imports DAL
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.IO
Public Class frmMain
Dim LocalDAL As New DAL.DataAccess
Dim dr As SqlDataReader
Dim dr2 As SqlDataReader
Dim strSQL As String
Dim intRec As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim gintRefresh As Integer
Dim gintDayID As Integer
Dim gstrWavFile As String = "C:\buzzer.wav"
Dim myTable As DataTable
Dim gintBlinkCnt As Integer
Dim gintLoopRec As Integer
Dim gintFlip As Integer
Dim gzone As String
Dim gfoundRows() As DataRow
Dim gintTotal As Integer
Dim TMac, Wmac As String
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
LocalDAL.ConnectionString = ConfigurationSettings.AppSettings.Get("LocalDB")
LocalDAL.Provider = EnumProviders.SQLClient
Me.gintRefresh = ConfigurationSettings.AppSettings.Get("Refresh(sec)")
Me.gintLoopRec = ConfigurationSettings.AppSettings.Get("LoopRec")
Me.gzone = ConfigurationSettings.AppSettings.Get("Zone")
If Me.gzone <> "ALL" Then
Me.lblPID.Text = Me.lblPID.Text & " [Zone: " & Me.gzone & "]"
End If
Me.tmrGrid.Interval = Me.gintRefresh * 1000
Me.tmrGrid.Enabled = True
Me.subDefineGrid()
'setting up open location
Me.SetDesktopLocation(ConfigurationSettings.AppSettings.Get("Xpos"), 0)
Me.Location = New Point(ConfigurationSettings.AppSettings.Get("Xpos"), 0)
Me.WindowState = FormWindowState.Maximized
Catch ex As Exception
Me.subErrLog("frmMain_Load", ex.Message)
End Try
End Sub
...