Trouble adding data from structure array to combobox on form


I have a program that reads data from 2 sequential data files. One file is called Employee and the other is Payroll. The form contains a open files button that allows the user to open both files. Once chosen the program reads the files and puts the data in the appropriate structure item. It also should load the employee ids from the employee file into the combobox which is on the form. I cannot seem to get the data to pull in from the structure and be added to the combobox. Any help would be appreciated. Here is my code and a sample of the employee file.

Main form code:

Imports System.Windows.Forms.OpenFileDialog Public Class empPayrollForm Private CurrentEmployeeList As EmployeeList Private CurrentPayrollList As PayrollList Private CurrentRecord As Integer Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click ' closes application Me.Close() End Sub Private Sub openFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles openFileButton.Click Dim payrollResult As DialogResult Dim employeeResult As DialogResult OpenEmpFileDialog.Title = "Please Select Master Employee File" OpenEmpFileDialog.Filter = "Text Files(*.txt)|*.txt| Files(*.*)|*.*" employeeResult = OpenEmpFileDialog.ShowDialog If employeeResult = Windows.Forms.DialogResult.OK Then CurrentEmployeeList = New EmployeeList(OpenEmpFileDialog.FileName) selEmpComboBox.Items.AddRange(Employee.empId) End If OpenPayrollFileDialog.Title = "Please Select Master Payroll File" payrollResult = OpenPayrollFileDialog.ShowDialog If payrollResult = Windows.Forms.DialogResult.OK Then CurrentPayrollList = New PayrollList(OpenPayrollFileDialog.FileName) End If End Sub

Module created containing structure employee and employeelist class as per project requirements that I use module-level dynamic arrays. I may be incorrectly using as module for this as I'm relatively new and when I saw module-level thought module:

Option Explicit On Option Strict On Imports System.IO Imports System.Convert Module Employee Public Structure Employee Public empId As Integer Public empName As String Public empAddress As String Public empSSN As String End Structure Public Class EmployeeList Private CurrentReader As StreamReader Private CurrentWriter As StreamWriter Private CurrentList(0) As Employee Private RecordCount As Integer Public Sub New(ByVal argFile As String) CurrentReader = New StreamReader(argFile) Call ReadEmployees(argFile) CurrentReader.Close() End Sub Private Sub ReadEmployees(ByVal argFile As String) Dim CurrentEmployee As Employee Dim Fields() As String Dim CurrentRecord As String Dim DelimiterChars() As Char = {ToChar(",")} CurrentRecord = CurrentReader.ReadLine() Do Until CurrentRecord Is Nothing Fields = CurrentRecord.Split(DelimiterChars) With CurrentEmployee .empId = CInt(Fields(0)) .empName = Fields(1) .empAddress = Fields(2) .empSSN = Fields(3) End With ReDim Preserve CurrentList(RecordCount) CurrentList(RecordCount) = CurrentEmployee CurrentRecord = CurrentReader.ReadLine() RecordCount += 1 Loop RecordCount += 1 End Sub End Class End Module

Posted On: Monday 24th of December 2012 01:13:12 AM Total Views:  218
View Complete with Replies

RELATED TOPICS OF Visual Basic PROGRAMMING LANGUAGE




getting ?

how do you get the value : into assemblyinfo
VIEWS ON THIS POST

87

Posted on:

Friday 2nd November 2012
View Replies!

1 to 12 ....

Month Count 1 10 2 40 3 15 7 26 that's what I get in a datatable when I look for numbers of members per month here >>> january, february, march, july, no members for other months I want to do a chart on 12 months how can I do a loop in my Datatable For i As Int32 = 0 To myDatatable.Rows.Count - 1 Next to get Month Count 1 10 2 40 3 15 4 0 5 0 6 0 7 26 8 0 9 0 10 0 11 0 12 0 a 0 for empty row with corresponding month
VIEWS ON THIS POST

60

Posted on:

Friday 2nd November 2012
View Replies!

VB.NET site search to search multiple words from a phrase

Hi , I need help changing the way the site search is done from just search a phrase as one string to searching a phrase "as multiple words" search. For example, if I search "cute puppy" right now, it will search it for "cute puppy" as phrase and won't match just "cute" and "puppy". The way the search is implemented is by passing a search phrase to a Stored Procedure in SQL Server. So now, I need to change to site search so when "cute puppy" is searched, it will search two words.... "cute" and "puppy" instead of just "cute puppy". So thats what I need help with. Below is how the store procedure is implemented ------------------------------------------------------------------------------------------- SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[SearchDS] ( \t @keyword varchar(200) \t ) AS BEGIN \t declare @search varchar (1000) \t if @keyword '' \t \t begin \t \t set @search = '%'+@keyword+'%' \t \t select * from products where sku like @search or title like @search or [description] like @search \t \t end \t else \t \t select * from products where id=-1 END ==============================================
VIEWS ON THIS POST

100

Posted on:

Wednesday 7th November 2012
View Replies!

Translate C# to VB

This is an example in C# I just can't seem to get right in VB. Can someone translate this for me: void Application_AuthenticateRequest (Object sender, EventArgs e) { \tHttpApplicationapp =(HttpApplication) sender;
VIEWS ON THIS POST

54

Posted on:

Wednesday 7th November 2012
View Replies!

Process coms using socket control - VB6

Does anyone know of a sample that uses the Microsoft WinSock control to perform inter-process communication please
VIEWS ON THIS POST

109

Posted on:

Wednesday 7th November 2012
View Replies!

Re: RealBasic to VisualBasic Conversion?

Hi ********** >Which bug I have a VB6 app that uses Windows Media Player. I spent many hours trying to get WMP to work in RB2006, but to no avail. Seeing as how RS is targetting the VB6 refugees, you would think they would at least be able to get this right. But no, it is just another checklist item that helps them target the shelfware market. I tried to write another small app. I often play MP3 files that are very long. If want to fast forward a few seconds, it is impossible with WMP or iTunes because the scroller controls jump me too far ahead. So, I just wanted to make a simple app that would have a WMP control, an Open button to open files, and a four buttons: +1, +30, -30, -1, that would move the MP3 ahead one second, 30 seconds etc. I spent an entire day trying to get RB2006 to do this simple thing. Then I gave up, took out VB6, a tool that is SEVERAL years old, and got it done in 15 minutes. Later, Matt Posted with yEncExpress. Get your free copy at www.techsono.com.
VIEWS ON THIS POST

56

Posted on:

Wednesday 7th November 2012
View Replies!

difference between protected, partial, public etc.

I'm new to this. Can someone explain the difference between the above. I am making some code to build a html string on the page_load to write to literals. What Sub should I use and for example (ByVal sender As Object... etc..... (what should I use here and what does it mean!)
VIEWS ON THIS POST

124

Posted on:

Wednesday 7th November 2012
View Replies!

Looping inside a loop (In an Access DB)

! I have a question that I can't seem to figure out the answer to and I'm sure when someone points out my issue, I'm going to kick my self and feel extremely dumb. I've run in to this before in my codes and I usually do some error handling and/or "shortcutting" to fix it but I decided its about time that I figure out why it's happening and fix it right. Here's my entire code so you know my starting points 'Fix the MRN's in the APPOINTMENT file so we can query them into the demo file. Fix in order of last appt date so we get the latest case MRN LDone = 0 NewMRN = 100 Set RSAppt = CurrentDb.OpenRecordset("SELECT * FROM Tbl_Advantix_Appts ORDER BY " & Format(DateValue(RSBU.Fields("ApptDate")), "MM/DD/YYYY") & " ASC, PatFullName, DOB") RSAppt.MoveFirst Do Until RSAppt.EOF If IsNull(RSAppt.Fields("MRN")) Then RSAppt.Delete RSAppt.MoveNext Else strMRN = RSAppt.Fields("MRN") If Not RSAppt.EOF Then Do Until RSAppt.Fields("MRN") strMRN Or RSAppt.EOF If Not RSAppt.EOF Then RSAppt.Edit RSAppt.Fields("MRN") = "CT" & NewMRN RSAppt.Update Else Exit Do End If RSAppt.MoveNext Loop End If End If LDone = LDone + 1 PRG.AXC.Value = (LDone / LCount) * 100 NewMRN = NewMRN + 1 'No move next because the field is either blank and going to be deleted or already triggered the inner loop to exit meaning its a new chart number that we have to store as StrMRN to fix next Loop Everything runs right up until the following If Not RSAppt.EOF Then Do Until RSAppt.Fields("MRN") strMRN Or RSAppt.EOF If Not RSAppt.EOF Then It runs fine up until the end of the RS then errors out with 'No Current Record'. As you can see, I've gone way overboard with the If statements to tell it that "IF it reaches EOF while performing this action, exit the loop" but it just doesn't seem to work with me. I could always do On Error GoTo 1 but my question is, can anyone see why I am getting the error to begin with Is there anyway I can modify this to do what I want AS ALWAYS, THANKS IN ADVANCE!!!!
VIEWS ON THIS POST

113

Posted on:

Saturday 10th November 2012
View Replies!

Visual basic chat application

Can someone please paste a link to a page that i can learn proper tcp protocols and communication programming as well "FTP ,TCP ect...." MOD EDIT: Topic closed. Here's a suggestion: type the terms you want to research into a search engine like Google or Bing. This post has been edited by JackOfTrades: 26 June 2010 - 08:27 AM
VIEWS ON THIS POST

68

Posted on:

Saturday 10th November 2012
View Replies!

Sending printer codes in VBA

Landscape printing to my Lexmark used to feed the right edge first through the printer. The left edge is suddenly feeding first. Using Word 2003 there is no choice of direction in Page Setup. Could I send code in a VBA macro to cure the problem and if so what
VIEWS ON THIS POST

84

Posted on:

Saturday 10th November 2012
View Replies!

designing databse for payroll system

I am designing a payroll system in Visual Basic 6. I am having problem in designing about how i would design a table to take entries on monthly basis for all the employees. . To be detailed I have already designed a table that takes entry of all the employees. Adds new and deleat old ones. The Add Employee Table is as follows: EmpId char10 EmpName char30 Address char30 PhoneNo char10 Datejoinig date designation char15 payscale curr empstatus bool
VIEWS ON THIS POST

74

Posted on:

Saturday 10th November 2012
View Replies!

winpop style

XP omitted the nice little winpop program because of security issues aparently. I would like to create a little prog like this to run on home network to quickly pass notes between machines or even audio(voice), but something small & ...
VIEWS ON THIS POST

54

Posted on:

Saturday 10th November 2012
View Replies!

Sending an email through VB 08 EE

, I am trying to figure out how to send an e-mail from my program with the contents of a richtextbox. For example: I am creating a notepad style program. And say I want to send what I wrote in the textbox via e-mail the short and quick way via the program. I want to be able to have the body of the email be the text that is written in the textbox on the main page. Here is the code. Any help would be greatly appreciated.
VIEWS ON THIS POST

103

Posted on:

Saturday 10th November 2012
View Replies!

Language Reference Won't Run

RB2006's Language Reference won't run on my system any more. It starts up, I see it in the Windows XP task bar, and then nothing. The program never opens a window. Re-running the RB installer didn't help. Anybody know how ...
VIEWS ON THIS POST

54

Posted on:

Sunday 11th November 2012
View Replies!

SOAP Google API

I was hoping there are some real SOAP examples out there for RealBasic I am trying to use the google API in an APP to do searches etc... need some serious help. Examples, Source Code, Projects, Please Anything...
VIEWS ON THIS POST

41

Posted on:

Sunday 11th November 2012
View Replies!

Printing Text

Oin Zea wrote: > Hi. > > I have a very long string. if I print it directly to the printer it gets cut > off. I need to know if there is a way to format the text so ...
VIEWS ON THIS POST

38

Posted on:

Sunday 11th November 2012
View Replies!

Cannot backup database because it is open

Before MDIMenu loads, the Microsoft Access Record-Locking Information file is not there. After the MDIMenu loads, it is there as a number of ADODCs are used in a certain function during MDIForm_Load. It appears on the first adodc.Refresh. I then go to the backup option. Dim JRO As JRO.JetEngine 'reference Microsoft Jet and Replication Objects 2.6 Library Set JRO = New JRO.JetEngine JRO.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\Project.mdb" & ";" & _ "Jet OLEDB:Database Password=;", "Provider=Microsoft.Jet.OLEDB.4.0;" & "Jet OLEDB:Engine Type=5;" & _ "Data Source=" & Dir1.Path & "\Backup - " & Format(Date, "mm dd yyyy") & " - " & _ Format(Time, "hh_mm_ss") & " - " & UserName & ".mdb" & ";" & "Jet OLEDB:Database Password=;" MsgBox "Database saved in " & Dir1.Path & ".", vbOKOnly + vbInformation, "Backup Database" It works if I set the backup form as startup. It does not work when the backup option is selected from the MDIMenu. The error message is "You attempted to open a database that is already opened exclusively by user 'username' on machine 'user-PC'. Try again when the database is available.". I guess it is because the Record-Locking Information file is open. I cannot Kill it because "Permission denied". I have tried adodc.Recordset.Close for each of the opened recordsets - the Record-Locking Information file is still open. I have spent hours trying to find a solution but to no avail. It is a headache and time is running short. How to close the database so that I can back it up This post has been edited by AN1554: 20 April 2012 - 08:36 PM
VIEWS ON THIS POST

111

Posted on:

Sunday 11th November 2012
View Replies!

online examination system

i am doing project in online stdent behaviour system based on their skills. i want you to help me the project on online exam developed in vb6
VIEWS ON THIS POST

125

Posted on:

Sunday 11th November 2012
View Replies!

Image Hotspots

I have a form that has a picture background that has the various buttons etc all labelled on so when the user clicks the button I just get the co-ordinated of the mouse down in the Mouse_Down event and ...
VIEWS ON THIS POST

43

Posted on:

Monday 12th November 2012
View Replies!

get text length

Any way to get the true on screen length in pixels/twips or other number other than characters
VIEWS ON THIS POST

88

Posted on:

Tuesday 20th November 2012
View Replies!

Filecopy in VB 1.0?

all, I want to write a small program for an old computer with Windows 3.1. Obviously, the program needs to be 16-bit, so I am using VB 1.0 to do this. I need to make a copy of a ...
VIEWS ON THIS POST

103

Posted on:

Tuesday 20th November 2012
View Replies!

Bound datagrid

I'm currently modifying an old program written some years ago..the programmer put in some forms a datagrid bound to an adodc control. Everything was ok but since yesterday the datagrids remain empty...When I print to the debug window the ...
VIEWS ON THIS POST

161

Posted on:

Tuesday 20th November 2012
View Replies!

UK tax

"a p & s" wrote in message news:blhbfd$43m$1@newsg2.svr.pol.co.uk... > Hi.....have a small staff of 6 employees and VB installed, and wish to > calculate thier wages (and don't wish to go down the Sage/Quick Books > route). > Can ...
VIEWS ON THIS POST

53

Posted on:

Tuesday 20th November 2012
View Replies!

Run-Time error 2147024770 (8007007e) Automation Error

I am getting this error in my VBA application starting about 2 weeks ago. Any suggestions...
VIEWS ON THIS POST

220

Posted on:

Wednesday 21st November 2012
View Replies!

Getting the record number of the record just added

, I use: VB 6 sp5 Access 2000 database DAO connection I have the following problem. I add a new record in the database and in the table is a Autonumbering field. I want to know that number. For example ...
VIEWS ON THIS POST

99

Posted on:

Monday 26th November 2012
View Replies!

Checking if a folder(not a file) is already open to view

! I have a program that creates a file and exports to a pre-selected folder on my network. What I'd like to do is find out if the user already has the folder open and if not, then open it. I can open the folder, and I tried some FileExists but I haven't had any luck. Is there a function in VB I can research that might work for this I don't have any code pertinant to this, as of yet, so there isn't really much for me to put here. As always ,
VIEWS ON THIS POST

104

Posted on:

Wednesday 28th November 2012
View Replies!

Datagrid update problem

i am working on class grades input. i want to import the grades of student from datagrid. but when i want to go to next record i got this message and update dose not take effect. Insufficient key column information for updating or refreshing I use sql command with inner join then i think this is the problem. But how can i get the input from users the attachment is the very simple sample for this problem. please guide me Attached File(s) Grades.zip (10.6K) Number of downloads: 83
VIEWS ON THIS POST

77

Posted on:

Wednesday 28th November 2012
View Replies!

Access db on a network

Now I have developed a database software for a company Using Access DB So they want the program to be distributed amongst employees and they all deal with the db through a network SO what should I do
VIEWS ON THIS POST

78

Posted on:

Wednesday 28th November 2012
View Replies!

Cursor & button issues

hello there brilliant programmers! am not gonna waste my time.so here im gonna ask you . First and foremost,there's a problem occur in my system. the cursor image wont disappear after i point to other button. the cursor still can move freely,but it will left the image of cursor after i pointed to another button print screen of my sytem http://farm5.static...._70dee380e9.jpg on the picture above,you can see the problem.i dont know how to state more,but can you rescue me with the greatest solution!the main probs are the button and cursor. the coding: Private Sub mnuallsale_Click() Rptsales.Show vbModal End Sub Private Sub Command1_Click() sndPlaySound App.Path & "\snap.wav", SND_ASYNC frmSale.Show vbModal End Sub Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Command1.BackColor = &HC0C0C0 Then Command1.BackColor = &H80FFFF Command2.BackColor = &HC0C0C0 Command3.BackColor = &HC0C0C0 Command4.BackColor = &HC0C0C0 Command5.BackColor = &HC0C0C0 Command6.BackColor = &HC0C0C0 Command7.BackColor = &HC0C0C0 'tool tips Image7.Visible = True Image8.Visible = False Image11.Visible = False Image15.Visible = False Image18.Visible = False Image19.Visible = False Image20.Visible = False Label9.Visible = False Label8.Visible = True Label9.Visible = False Label10.Visible = False Label11.Visible = False Label12.Visible = False Label13.Visible = False Label14.Visible = False End If End Sub Private Sub Command2_Click() sndPlaySound App.Path & "\snap.wav", SND_ASYNC FrmAdminPass.Show vbModal End Sub Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Command2.BackColor = &HC0C0C0 Then Command2.BackColor = &H80FFFF Command1.BackColor = &HC0C0C0 Command3.BackColor = &HC0C0C0 Command4.BackColor = &HC0C0C0 Command5.BackColor = &HC0C0C0 Command6.BackColor = &HC0C0C0 Command7.BackColor = &HC0C0C0 Image8.Visible = True Image11.Visible = False Image7.Visible = False Image15.Visible = False Image18.Visible = False Image19.Visible = False Image20.Visible = False Label9.Visible = False Label9.Visible = True Label8.Visible = False Label10.Visible = False Label11.Visible = False Label12.Visible = False Label13.Visible = False End If End Sub Private Sub Command3_Click() sndPlaySound App.Path & "\snap.wav", SND_ASYNC frmAddCategory.Show End Sub Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Command3.BackColor = &HC0C0C0 Then Command3.BackColor = &H80FFFF Command2.BackColor = &HC0C0C0 Command1.BackColor = &HC0C0C0 Command4.BackColor = &HC0C0C0 Command5.BackColor = &HC0C0C0 Command6.BackColor = &HC0C0C0 Command7.BackColor = &HC0C0C0 Image11.Visible = True Image8.Visible = False Image7.Visible = False Image15.Visible = False Image18.Visible = False Image19.Visible = False Image20.Visible = False Label9.Visible = False Label10.Visible = True Label9.Visible = False Label8.Visible = False Label11.Visible = False Label12.Visible = False Label13.Visible = False Label14.Visible = False End If End Sub Private Sub Command4_Click() sndPlaySound App.Path & "\snap.wav", SND_ASYNC frmFind.Show vbModal End Sub Private Sub Command4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Command4.BackColor = &HC0C0C0 Then Command4.BackColor = &H80FFFF Command2.BackColor = &HC0C0C0 Command3.BackColor = &HC0C0C0 Command1.BackColor = &HC0C0C0 Command5.BackColor = &HC0C0C0 Command6.BackColor = &HC0C0C0 Command7.BackColor = &HC0C0C0 Image15.Visible = True Image8.Visible = False Image11.Visible = False Image7.Visible = False Image18.Visible = False Image19.Visible = False Image20.Visible = False Label9.Visible = False Label11.Visible = True Label9.Visible = False Label10.Visible = False Label8.Visible = False Label12.Visible = False Label13.Visible = False Label14.Visible = False End If End Sub Private Sub Command5_Click() sndPlaySound App.Path & "\snap.wav", SND_ASYNC frmHelp.Show End Sub Private Sub Command5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Command5.BackColor = &HC0C0C0 Then Command5.BackColor = &H80FFFF Command2.BackColor = &HC0C0C0 Command3.BackColor = &HC0C0C0 Command4.BackColor = &HC0C0C0 Command1.BackColor = &HC0C0C0 Command6.BackColor = &HC0C0C0 Command7.BackColor = &HC0C0C0 Image18.Visible = True Image8.Visible = False Image11.Visible = False Image15.Visible = False Image7.Visible = False Image19.Visible = False Image20.Visible = False Label9.Visible = False Label12.Visible = True Label9.Visible = False Label10.Visible = False Label11.Visible = False Label8.Visible = False Label13.Visible = False Label14.Visible = False End If End Sub Private Sub Command6_Click() sndPlaySound App.Path & "\snap.wav", SND_ASYNC If MsgBox("Are you sure you want to exit", vbOKCancel) = vbOK Then frmLogin.txtUserName.Text = "" frmLogin.txtPassword.Text = "" frmSplash.Show Unload Me End If End Sub Private Sub Command6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Command6.BackColor = &HC0C0C0 Then Command6.BackColor = &H80FFFF Command2.BackColor = &HC0C0C0 Command3.BackColor = &HC0C0C0 Command4.BackColor = &HC0C0C0 Command5.BackColor = &HC0C0C0 Command1.BackColor = &HC0C0C0 Command7.BackColor = &HC0C0C0 Image20.Visible = True Image8.Visible = False Image11.Visible = False Image15.Visible = False Image18.Visible = False Image19.Visible = False Image20.Visible = False Label7.Visible = False Label14.Visible = True Label9.Visible = False Label10.Visible = False Label11.Visible = False Label12.Visible = False Label13.Visible = False Label8.Visible = False End If End Sub Private Sub Command7_Click() sndPlaySound App.Path & "\snap.wav", SND_ASYNC Programmers.Show End Sub Private Sub Command7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Command7.BackColor = &HC0C0C0 Then Command7.BackColor = &H80FFFF Command2.BackColor = &HC0C0C0 Command3.BackColor = &HC0C0C0 Command4.BackColor = &HC0C0C0 Command5.BackColor = &HC0C0C0 Command6.BackColor = &HC0C0C0 Command1.BackColor = &HC0C0C0 Image19.Visible = True Image8.Visible = False Image11.Visible = False Image15.Visible = False Image18.Visible = False Image19.Visible = False Image20.Visible = False Label7.Visible = False Label13.Visible = True Label9.Visible = False Label10.Visible = False Label11.Visible = False Label12.Visible = False Label8.Visible = False Label14.Visible = False End If End Sub Private Sub Form_Load() Label3 = frmLogin.txtUserName.Text l3 = Date 'ShockwaveFlash1.Movie = App.Path & "\carousel.swf" End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Command1.BackColor = &H80FFFF Then Command1.BackColor = &HC0C0C0 End If If Command2.BackColor = &H80FFFF Then Command2.BackColor = &HC0C0C0 End If If Command2.BackColor = &H80FFFF Then Command2.BackColor = &HC0C0C0 End If If Command3.BackColor = &H80FFFF Then Command3.BackColor = &HC0C0C0 End If If Command4.BackColor = &H80FFFF Then Command4.BackColor = &HC0C0C0 End If If Command5.BackColor = &H80FFFF Then Command5.BackColor = &HC0C0C0 End If If Command6.BackColor = &H80FFFF Then Command6.BackColor = &HC0C0C0 End If If Command7.BackColor = &H80FFFF Then Command7.BackColor = &HC0C0C0 End If End Sub Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Command2.BackColor = &HC0C0C0 Command3.BackColor = &HC0C0C0 Command4.BackColor = &HC0C0C0 Command5.BackColor = &HC0C0C0 Command6.BackColor = &HC0C0C0 Command7.BackColor = &HC0C0C0 Command1.BackColor = &HC0C0C0 End Sub Private Sub mnubalance_Click() frmFind.Show End Sub Private Sub mnuedit_Click() FrmAdminedit.Show vbModal End Sub Private Sub mnuexit_Click() If MsgBox("Are you sure you want to exit", vbOKCancel) = vbOK Then End End If End Sub Private Sub mnumsale_Click() frmSale.Show vbModal End Sub Private Sub mnunewstaff_Click() FrmAdminPass.Show vbModal End Sub Private Sub mnunewstock_Click() frmMaster.Show vbModal End Sub Private Sub mnuoption_Click() FrmAdminvsales.Show vbModal End Sub Private Sub Timer1_Timer() l2 = Time End Sub Private Sub Timer2_Timer() If Label6.Left >= -2000 Then Label6.Left = Label6.Left - 100 ElseIf Label6.Left = -1000 Then Label7.Left = Label6.Left - 100 ElseIf Label7.Left
VIEWS ON THIS POST

86

Posted on:

Wednesday 28th November 2012
View Replies!

Retrieving value from text box

If Val("Channel1.Device2.PROGRAM:MAINPROGRAM.Switch1") = "1" Then Text3 = ("ON") Else Text3 = ("OFF") End If Hi im kinda new to the ole VB. Basically I want to change the value of a text box so that when my input device is 1 the box displays ON and when 0 it diaplys OFF. How do i retrieve the 1 or 0 value from the input "channel1........." This post has been edited by davkav: 11 March 2008 - 05:12 AM
VIEWS ON THIS POST

85

Posted on:

Wednesday 28th November 2012
View Replies!

Winsock question

hi, i'm making a project where i have a server and a client form, the client form has several command buttons and so does the sever. So what i'm practicly trying to do, but failed inall my attempts, is to use winsock to do this. let me give an example for instance if i press commandbutton1 on client form, i want it to send data to the server form, once the server form recieves this data the commandbutton1 on server should be clicked too. but the problem is i have no idea how to code this i spent hours looking through tutorials, reading books trying to code something on my ownbut all failed. i'd appreciate it if someone could lookinto this and give me some help
VIEWS ON THIS POST

69

Posted on:

Wednesday 28th November 2012
View Replies!

trim string by "\", "."

i want to how to trim string by "\", "."
VIEWS ON THIS POST

79

Posted on:

Wednesday 28th November 2012
View Replies!

Creating a txt file from an SQL query within an if

" So what i am trying to do is query from two databases and get results from both, but i want the querys to spit out a text file on my desktop, what imports or dim would i need, any help or samlpes, and i am wanting the code within the if statments below Imports System.Data.SqlClient Imports System.Runtime.InteropServices Imports System.Array Imports System.Net.Sockets Imports System.Net.Sockets.TcpClient Imports System Imports System.Threading Imports System.IO Imports Microsoft.VisualBasic Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cn As New SqlConnection("Data Source=;User Id=;Password=") Dim strSQLMTCensus As String = "Select Count(*) as MTCnt from altlivedb.dbo.EPRCensusMT" Dim MaxRec As Integer Dim MTAcctNum, MTUnitNum, strSQLBV As String Dim MTAdmitDate As Date Dim FSO Dim mtEPRresults cn.Open() Dim dr As SqlDataReader Dim cmd As New SqlCommand(strSQLMTCensus, cn) dr = cmd.ExecuteReader dr.Read() MaxRec = CType(dr.Item("MTCnt").ToString, Integer) dr.Close() For Cnt As Integer = 1 To 1 Dim strSQL As String = "Select AccountNumber, UnitNumber, AdmitDateTime from altlivedb.dbo.EPRCensusMT Where RecID =" & Cnt Dim dr1, dr2 As SqlDataReader Dim cmd1 As New SqlCommand(strSQL, cn) dr1 = cmd1.ExecuteReader dr1.Read() MTAcctNum = dr1.Item("AccountNumber").ToString MTUnitNum = dr1.Item("UnitNumber").ToString MTAdmitDate = dr1.Item("AdmitDateTime").ToString strSQLBV = "SELECT UnitNumber, AccountNumber, Name, AdmitDateTime, DischargeDateTime " & _ "FROM BarVisits " & _ "WHERE (UnitNumber LIKE '%" & MTUnitNum & "%') AND (AccountNumber LIKE '%" & MTAcctNum & "%')" 'Dim cmd1 As New SqlCommand(strSQLBV, cn)' cmd1.CommandText = strSQLBV dr1.Close() dr2 = cmd1.ExecuteReader() dr2.Read() If IsDBNull(dr2.Item("DischargeDateTime").Value) = True And IsDBNull(dr2.Item("AdmitDateTime").ToString) = False Then 'spit out text file" ElseIf IsDBNull(dr2.Item("DischargeDateTime").Value) = True And IsDBNull(dr2.Item("AdmitDateTime").ToString) = True Then 'Send an A11 message to cancel' End If dr1.Close() dr2.Close() Next cn.Close() End Sub End Class
VIEWS ON THIS POST

80

Posted on:

Thursday 29th November 2012
View Replies!

Basic help

hi, i am trying to get this program to run a snipit of code if the checkbox is check and not run it if it is not checked. checkbox has 18 options it looks fine but runs the code checked or un-checked i need some kind of if then else statement but i an a newbie and cant figure it out this is not visual basic i am sure you know but this is EXTRA basic marco editor from a mainframe but since the coding is simular and i cant seem to find help i came here i hope you can help me out here, thanks ' Global variable declarations Global g_HostSettleTime% Global g_szPassword$ Sub Main() '-------------------------------------------------------------------------------- ' Get the main system object Dim Sessions As Object Dim System As Object Set System = CreateObject("EXTRA.System") ' Gets the system object If (System is Nothing) Then Msgbox "Could not create the EXTRA System object. Stopping macro playback." STOP End If Set Sessions = System.Sessions If (Sessions is Nothing) Then Msgbox "Could not create the Sessions collection object. Stopping macro playback." STOP End If '-------------------------------------------------------------------------------- ' Set the default wait timeout value g_HostSettleTime = 400 ' milliseconds OldSystemTimeout& = System.TimeoutValue If (g_HostSettleTime > OldSystemTimeout) Then System.TimeoutValue = g_HostSettleTime End If 'Dim CheckBox1() as Integer 'ReDim CheckBox1(0) 'Dim CheckBox2() as Integer 'ReDim CheckBox2(0) 'Dim CheckBox3() as Integer 'ReDim CheckBox3(0) 'Dim CheckBox4() as Integer 'ReDim CheckBox4(0) 'Dim CheckBox5() as Integer 'ReDim CheckBox5(0) 'Dim CheckBox6() as Integer 'ReDim CheckBox6(0) 'Dim CheckBox7() as Integer 'ReDim CheckBox7(0) 'Dim CheckBox8() as Integer 'ReDim CheckBox8(0) 'Dim CheckBox9() as Integer 'ReDim CheckBox9(0) 'Dim CheckBox10() as Integer 'ReDim CheckBox10(0) 'Dim CheckBox11() as Integer 'ReDim CheckBox11(0) 'Dim CheckBox12() as Integer 'ReDim CheckBox12(0) 'Dim CheckBox13() as Integer 'ReDim CheckBox13(0) 'Dim CheckBox14() as Integer 'ReDim CheckBox14(0) 'Dim CheckBox15() as Integer 'ReDim CheckBox15(0) 'Dim CheckBox16() as Integer 'ReDim CheckBox16(0) 'Dim CheckBox17() as Integer 'ReDim CheckBox17(0) 'Dim CheckBox18() as Integer 'ReDim CheckBox18(0) Begin Dialog cbdlg 228, 150, 221, 287, "Mastercard Chargebacks and fraud reporting" ButtonGroup .bg OkButton 141, 67, 50, 14 CancelButton 141, 109, 50, 14 CheckBox 0, 0, 40, 10, "LINE1", .CheckBox1 CheckBox 0, 14, 40, 10, "LINE2", .CheckBox2 CheckBox 0, 30, 40, 10, "LINE3", .CheckBox3 CheckBox 0, 47, 40, 10, "LINE4", .CheckBox4 CheckBox 0, 61, 40, 10, "LINE5", .CheckBox5 CheckBox 0, 78, 40, 10, "LINE6", .CheckBox6 CheckBox 0, 95, 40, 10, "LINE7", .CheckBox7 CheckBox 0, 113, 40, 10, "LINE8", .CheckBox8 CheckBox 0, 132, 40, 10, "LINE9", .CheckBox9 CheckBox 0, 150, 40, 10, "LINE10", .CheckBox10 CheckBox 0, 166, 40, 10, "LINE11", .CheckBox11 CheckBox 0, 181, 40, 10, "LINE12", .CheckBox12 CheckBox 0, 196, 40, 10, "LINE13", .CheckBox13 CheckBox 0, 211, 40, 10, "LINE14", .CheckBox14 CheckBox 0, 227, 40, 10, "LINE15", .CheckBox15 CheckBox 0, 241, 40, 10, "LINE16", .CheckBox16 CheckBox 0, 257, 40, 10, "LINE17", .CheckBox17 CheckBox 0, 269, 40, 10, "LINE18", .CheckBox18 Text 48, 6, 143, 8, "Please check the checkboxes" Text 48, 16, 153, 8, "to the left to report fraud and do the " Text 48, 27, 152, 9, "Chargeback for the selected row or rows. " End Dialog Dim mydialog as cbdlg On Error Resume Next Dialog mydialog If Err=102 then MsgBox "Chargebacks canceled." End If 'DlgEnable "CheckBox1",1 ' Set the default wait timeout value g_HostSettleTime = 400 ' milliseconds OldSystemTimeout& = System.TimeoutValue If (g_HostSettleTime > OldSystemTimeout) Then System.TimeoutValue = g_HostSettleTime End If ' Get the necessary Session Object Dim Sess0 As Object Set Sess0 = System.ActiveSession If (Sess0 is Nothing) Then Msgbox "Could not create the Session object. Stopping macro playback." STOP End If If Not Sess0.Visible Then Sess0.Visible = TRUE If DlgValue("CheckBox1")=1 then ' This section of code contains the recorded events Sess0.Screen.Sendkeys("CCM 01 4837 999") Sess0.Screen.WaitHostQuiet(g_HostSettleTime) Sess0.Screen.Sendkeys("DS02UNAUTH TRANS02100") Sess0.Screen.Sendkeys("") Sess0.Screen.WaitHostQuiet(g_HostSettleTime) 'Sess0.Screen.Sendkeys("CDS") 'Sess0.Screen.WaitHostQuiet(g_HostSettleTime) 'This section of code contains the recorded events Sess0.Screen.Sendkeys("CSD4 01") Sess0.Screen.WaitHostQuiet(g_HostSettleTime) Sess0.Screen.Sendkeys("011") Sess0.Screen.Sendkeys("") 'Sess0.Screen.Sendkeys("cds") System.TimeoutValue = OldSystemTimeout ElseIf DlgValue("CheckBox1")=0 then End If End Sub ***edited code tags*** -jjsaw5 This post has been edited by cheetahz: 05 December 2008 - 07:57 AM
VIEWS ON THIS POST

64

Posted on:

Thursday 29th November 2012
View Replies!

Airlines Reservation

hiiiiiiii,,,this is Himanshu here...i wanna some ideas on airlines reservation topic,,i.e some hints for coding,as well as forms.hoping a good help and total response from ur side.my email id is {REMOVED}..I m doing sybsc (comp science).I am the member of this website
VIEWS ON THIS POST

77

Posted on:

Thursday 29th November 2012
View Replies!

Help with Instr and Substring

I'm working on a project in which the user will type a date in a Textbox and the program will display the next 5 characters (which represent whatever event) following the date in the text file in which both are saved. The problem I am having is with finding the location of the event in the text file during program execution. Where the Startindex is required in my code for the Substring Method to run I have used an Integer variable called "result", which represents the location of "sdate" in the text file. This is the value I need to retrieve "sevent" (this is not a string itself, but a variable representing whatever string is in that location) from the text file. However, using the variable "result" where an integer is required causes an "Argument out of range" exception, because VB wants an actual Integer and will not seem to accept an Integer variable. Any help would be appreciated. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sdate As String Dim result As Integer Dim sevent As String sdate = TextBox1.Text Dim DatesandSales As String DatesandSales = My.Computer.FileSystem.ReadText("C:\Users\Darlene\Desktop\salesevents.txt") Display.Text = DatesandSales result = InStr(DatesandSales, sdate) sevent = sdate.Substring(result + 9, 5) TextBox2.Text = sevent End Sub
VIEWS ON THIS POST

63

Posted on:

Thursday 29th November 2012
View Replies!

Monitoring folder for new files

First question I must is ask is are you using Visual Basic 6 or VB.Net (Visual Basic 2005, Visual Basic 2005 Express Edition are VB.Net). let me know and I'll do what I can to help you
VIEWS ON THIS POST

62

Posted on:

Thursday 29th November 2012
View Replies!

How to copy Webbrowser content to text file

Am using a webBrowser to display my chat sessions. i want to give users the chance to save the chat log at anytime so i use this code 1. wbDialog.document.activeElement.innerText what i have realized is that only the text in the webbrowser is captured here leaving the smilies which maybe in the webbrowser. Can anyone help me with How to copy Webbrowser content with images to text file or word.
VIEWS ON THIS POST

46

Posted on:

Friday 30th November 2012
View Replies!

Prevent Illegal Copying

Consider this scenario... I have written a program for interest calculation for various penalties relating to income tax. Eventhough it's free and for my friends only, i don't want it to be distributed outside the circle without my permission. 1. The program should search for a machine ID which is created at the time of installation and stored in a separate folder e.g., in Windows/system. This particular machine ID shud be created whenever the program runs and checked with the previous ID stored. the sample code in my mind is like this Private Declare Function GetComputerName Function ComputerName() As String ' This will return the name of the computer Dim BUFFER As String, Length As Long Length = Len(BUFFER) If GetComputerName(BUFFER, Length) Then ComputerName = Left(BUFFER, Length) End If End Function === whether this will get the computername, i have to check it from home. This post has been edited by PsychoCoder: 02 August 2009 - 08:14 AM
VIEWS ON THIS POST

47

Posted on:

Friday 30th November 2012
View Replies!

CursonType,Locktype

Can anybody explain the following used in a query. Cursor type: adOpenDynamic,adOpenForwardOnly,adOpenKeyset,adOpenStatic Lock Type adLockBatchOptimistic,adLockOPtmistic,adLockPessimistic,adLockReadOnly if rs6.state=1 then rs6.close rs6.Open "Select * from Issues ", Cn, adOpenKeyset, adLockOptimistic
VIEWS ON THIS POST

82

Posted on:

Friday 30th November 2012
View Replies!

connecting vb6 to sql server 2005

After starting my first programming in vb2005 express edition and an sql server 2005 and not sql express, I'm unable to connect it to the DB hence have decided to try VB6 to sqlserver 2005 but still can't connect. My module code for connection in vb6 is Public adoConn As New ADODB.Connection Public adoCmd As ADODB.Command Public strConn As String Public adoRst As ADODB.Recordset Public Function ConnDB() adoConn = New ADODB.Connection strConn = "Data Source=localhost; Provider=SQLOLEDB.1;Initial Catalog=HRMS;Integrated Security=SSPI;" With adoConn .Mode = ADODB.ConnectModeEnum.adModeShareDenyNone .CursorLocation = ADODB.CursorLocationEnum.adUseClient .ConnectionString = strConn ''.show() End With ' adoCmd = New ADODB.Command 'adoCmd.ActiveConnection = adoConn 'adoCmd.CommandType = adCmdText End Function My form1 save command code for testing connection is as below; Private Sub cmdSave_Click() ''Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click Call ConnDB adoConn.Execute ("Insert into dbo.testy (firstname,address,status,phone,location) values ('" & txtfname.Text & "','" & txtaddress.Text & "','" & cbostatus.Text & "','" & txtlocation.Text & "','" & txtphone.Text & "')") MsgBox ("Details Saved") '' End ConnDB() '' frm1.Show() End Sub Please assist and advice between VB6 and vb2005 express which I should go for\t\t Edited by macosxnerd101: Please use code tags, like so: . Also, please avoid using excessive whitespace.
VIEWS ON THIS POST

77

Posted on:

Friday 30th November 2012
View Replies!

is visual basic 6 interpreter for C ?

hi there me and my brother discussed a lot about this. he say that eventually before it is build the exe on vb program it is made to C code and then to assembly. well i think it is not. but i did not find a thing about it. so is it or is it not
VIEWS ON THIS POST

68

Posted on:

Friday 30th November 2012
View Replies!

Basic Collisions

Could plz plz plz plz plz someone help me on how to do basic collisions, i have to do this game thing for school in VB6.0 so i have decided to do a pacman style game, i can do pretty much the basics like moving my sprite etc. But i need help with the collision aspect. The main thing is that my walls will be in an array, so i want some sort of code that will help my sprite stay within the walls. So really how do you make collisions with arrays, if you all could please help me, you WILL make my day note i am and have to do this in vb6.0!!!
VIEWS ON THIS POST

53

Posted on:

Friday 30th November 2012
View Replies!

VB6 always on top problems with fullscreen

I am trying to make a tool for a fullscreen game, but im having problems with making it always on top, it does work, but just not in fullscreen, this is what i got: Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, &H1 Or &H2 Ive tried searching google and many more sites but i couldnt find a solution, hope someone here can help me further This post has been edited by TyVeryMuch: 09 January 2008 - 12:41 PM
VIEWS ON THIS POST

100

Posted on:

Friday 30th November 2012
View Replies!

i'm after a more accurate timing sytem

Hi This is my first effort in VB programming i am trying to dreate a timing sytem for running events that i manage i want to just press, say Ctrl Q in excel and the time from the start of the race is displayed i have included some code that basically does what i want but it derived using the Now(0) function and it diplays the Now(0 time in a cell then Drops down to the cell undeneath Sub NOWTIME() On Error Resume Next With Selection .Value = Now() .NumberFormat = "hh:mm:ss" ActiveCell.Offset(1, 0).Select End With If Err.Number 0 Then Beep End If End Sub what i want to do is have a start time and then times as people cross the line in a sequential order down the excel sheet i hope someone can give me some clues regards robertg55 This post has been edited by Atli: 08 May 2012 - 06:08 PM Reason for edit:: Please use [code] tags when posting code.
VIEWS ON THIS POST

65

Posted on:

Sunday 2nd December 2012
View Replies!

write to 2nd line in text

hi programmers how i write text on the second line in text first line haven't to rewrite Open "C:\settings.set" For Output As #3 '\t Close #3 thx
VIEWS ON THIS POST

58

Posted on:

Sunday 23rd December 2012
View Replies!