vb.net - Opening winforms in the same screen

I have an application with multiple win forms. I have noticed is that if the user has multiple screen displays and changes the application to one screen, the other forms that are called by other buttons, will open in the main display and not where my main application or form is. How can I change this?...Read more

vb.net - Setting the location of dynamic textboxes drawn

I have a main form that allows the user the create questions for a questionaire. When the form opens up, the form will be blank with a button to "Add Questions and answers" This button will open up a new form where the user can set up the questions and answers. Once the user enters in the first question and answer, they will be taken back to the main screen and the first question and answer will be populated on that main screen. This works exactly the way I need it to. The problem is that when I want to enter a second question and answer, ...Read more

vb.net - Closing winform from button on another winform. Form will not close

I have 2 forms on my application. I have the main form that opens TopMost, CenterScreen and Maximized. Then I have another form on this screen that pops open when I press a button. That second screen has a button that navigates to another screen, so when I press that button the second form closes, and the main form is suppose to close as well and the selected sheet open up.However, the second screen closes fine, but my main screen remains open and active, while the called sheet opens but does not enable. I track down what was happening and th...Read more

vb.net - Reuse the same winform in procedure

I apologize if my question title is a bit vague. I have the procedure below that calls the form. The hyperlink calls the same form, passing through a sub. All that works well, the problem is that if I click one link and then another, the form opens twice, which is what is supposed to happen because I am instantiating the form as New. What I want to do is to only have same form open so that if the user clicks links then only one form opens not several. Private Sub dsbPositionBoard_FollowHyperlink(Target As Microsoft.Office.Interop.Excel.Hyper...Read more

vb.net - Open workbook and select worksheet from winform

I created two projects. One project is a windows form, and the other project is an Excel workbook project. I then added the Excel workbook project to the windows form project.The window form is a welcome page. That page has some buttons that are supposed to open the workbook on a specific worksheet. For example, the screenshot below has a button Summary Worksheet, when the user clicks that button, I want to open the Excel project, on a spreadsheet by that name.If my welcome page form was part of my Excel workbook project or any other workbook s...Read more

vb.net - Setting a windows form's screen position based on another form's current position

I am creating an application with multiple windows forms. The main form is movable, and I want a confirmation window to flash based on where the main form is located.For example, the main form opens, user drags it 200 points to the left. How do I make sure the confirmation window, upon button-press, opens up exactly to the left of that window?The built-in properties (center screen, center parent, etc.) don't provide this functionality.I'm aware of these functions:Form1.Left += 200andDim frmAccounts as new Form()Set FrmAccounts.DesktopLocation...Read more

vb.net - Close two open forms together in a Winforms application

I am working on a Windows forms applicationIn the parent form I open two forms together - FrmrecievedDelivaryRequest and FrmReleasedInPodiumIn parent form I opened two forms like this:frm1 = New FrmrecievedDelivaryRequestfrm1.Location = New Point(375, 0)frm1.MdiParent = Mefrm1.Show()frm6 = New FrmReleasedInPodiumfrm6.Location = New Point(809, 0)frm6.MdiParent = Mefrm6.Show()in FrmReleasedInPodium I have a close button.When clicking the close button I have to close both forms, so I wrote this code: Me.Close() Dim form2 = New FrmrecievedDelivar...Read more

vb.net - how to make multiple windows forms fit at any resolution in winform application

i am working on vb.net windows application..in master form i am calling two forms together..but while changing the screen resolution the forms are displaying not correctly...i want to display this form fit to screen always..in master form i am calling form like this: Dim frmVE As VisitorInfo Dim frmVX As VisitorExitsignin ToolStripMenuItem_Click i have a code like thisfrmVX = New VisitorExitsign frmVX.Location = New Point(781, 0) frmVX.MdiParent = Me frmVX.Show() frmVE = New VisitorInfo frmVE.Location = New...Read more

vb.net - Winforms combobox bug - 2 items with the same value but different key

Is this truly a bug in Winforms in 2015 or am I just doing something wrong...1) Create a new winforms project (.net 4.0) and add a combobox to the main form.2) Use this for your form load code:Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load Dim items As New Dictionary(Of Integer, String) items.Add(1, "Value 1") items.Add(2, "Value 2") items.Add(3, "Value 3") items.Add(4, "Value 3") Dim dataSource As New BindingSource(items, Nothing) ComboBox1.DataSource = dataSource ComboBox1.DisplayMember = "Val...Read more

Vb.net Winforms MDI multiple instance of form open

I want to know that how open multiple form in MDI parent form without duplicate same instances?For example: License Form and User Form open at the same time without duplicate. For Each f As Form In Application.OpenForms If f.Name = "License" Then FormOpen = True f.Focus() Return End If If f.Name = "User" Then FormOpen = True f.Focus() Return End If Next If FormOpen = False Then If e...Read more

How to use datagridview cell for a WHERE clause statement in vb.net

i had this sql query in vb.net where i have to use datagridview cell as parameter for the SELECT query.here is the code:Private Sub ClassSchedule() Dim strConn As String = My.Settings.SLCBRegistrarDBConnectionString Dim sqlCon As SqlConnection = New SqlConnection(strConn) Try sqlCon.Open() Dim QUERY As String QUERY = "SELECT CSchedClass.SCode as Code, ListofSubjects.[Course No.], ListofSubjects.[Descriptive Title], CSchedSubTD.TimeAndDay as Schedule, UtlyRoom.RoomName as Room, CSchedSubInstr...Read more

math - VB.NET - Getting a NaN result, can't figure out why

I'm trying to write a simple GPA calculator where the user enters a grade from an item on a combobox (A,B,C,D,F) and the credit hours of the course, and the calculation will output into a textbox. However, I keep getting a NaN result within the textbox and I can't for the life of me understand why. I've only got a bit of programming experience, so I'd appreciate any help! Public Class Form1 Public points As Double, hours As Integer Private Sub btnRecord_Click(sender As Object, e As EventArgs) Handles btnRecord.Click Dim gpaPoint...Read more

vb.net - Structures and Split

I am having difficulty with my vb program as my structure array will not fill with data from a text file which has been split using the split command. Puzzled. Any suggestions would be great. Code is below.Imports System.IOPublic Class Form1 Public Structure ScavRecord Public latitude As String Public longitude As String Public message As String Public encrypted As String End Structure Dim Scav(4) As ScavRecord Dim nextScav As Integer Private Sub btnView_Click(sender As Object, e As EventArgs) Handles ...Read more

file - VB.NET Final line of textfile not being displayed

I've built this game in vb.net windows forms called Go. Once the game finishes, it leads to a match breakdown screen. One of the features is a leaderboard. I have created a text file that stores the total number of points for each player in this so it can be displayed on the screen. I am updating the score after the game has finished by appending the new score to the textfile. If a player is new to the game, then a new record will be created. All records will be displayed in the leaderboard on the form.The issue I am having is that when a new p...Read more

visual studio - SCPI Command VB.net negative integer to string error

In VB.net, I am sending SCPI commands via GPIB-to-USB to an agilent/keysight device. I am using this sample to write data to instruments. https://www.keysight.com/main/editorial.jspx?cc=BR&lc=por&ckey=492255&nid=-33170.1090751.08&id=492255Here is a portion of my code that I am having trouble with.Dim P As Integer Dim Power As Integer For P = -50 To 0 Step 10 System.Threading.Thread.Sleep(500) Power = P instrument.WriteString("POW" & Str$(P) & "dbm") Console.WriteLine("Power" & P) 'Te...Read more