write to a txt file from a list box


how do i write to a txt file from a list box

heres my attempt (sad)
Open cdSave.FileName For Output As #1 Print #1, frmKeyHold.lstKeys.list Close #1

pls help soon im vry close to finishing this
Posted On: Monday 24th of December 2012 01:10:02 AM Total Views:  232
View Complete with Replies

RELATED TOPICS OF Visual Basic PROGRAMMING LANGUAGE




PID controller

i've got task in designing PID controller using vb6.. anyone familiar/can help with it\t
VIEWS ON THIS POST

62

Posted on:

Wednesday 28th November 2012
View Replies!

ListView .FindItem does not work

I'm trying to check for duplicate item from a textbox in my listview object before adding a new row. It doesn't seem to work because it still adds a new row in my listview after clicking 'Add'. Here's my code: Private Sub cmdAddBook_Click() enablebtn Dim li As ListItem Set li = lvBooksBorrowed.FindItem(txtAccNo.Text, lvwText, , lvwPartial) If Not li Is Nothing Then li.Selected = True li.EnsureVisible MsgBox "Book is already in the list", vbExclamation Exit Sub clearfields txtAccNo.Text End Sub what seems to be the problem all help that I can get are greatly appreciated.
VIEWS ON THIS POST

135

Posted on:

Wednesday 28th November 2012
View Replies!

VBA Access Programming

I'm a decent Visual Basic programmer, and I have a goal I am trying to accomplish within access. I've done some google searches for quick syntax guides for the access commands, but I haven't found much. We are linking two databases: an ODBC database used by eBay Blackthorne software, and an access database of Stone Edge Order Manager, which runs in Access. Basically what I'm trying to do is update a certain text field with once value if a different integer field is greater than zero, to something else if it is zero or below. This will be a function that we run daily that checks every record in our inventory table. Here's a simplified version of the logic it will use: Loop (all records) { If Table1.[Field] > 0 { Table2.[Field] = "RUN" } Else{ Table2.[Field] = "END" } Keep in mind we would have to match the data using some sort of key, that's the logic that I can't figure out. Realistically there will be more fields to update, I just need a little push or maybe a link to help me with the syntax. I'm not asking you to write code for me, just help me with the access VBA implementation, I can take it from there.
VIEWS ON THIS POST

52

Posted on:

Wednesday 28th November 2012
View Replies!

Interrupt for doing other services

Some years ago I remember there was a vb instruction that would create an Interrupt for system to do other services for long running read/write files operation. Anyone remember that instruction Sam
VIEWS ON THIS POST

124

Posted on:

Wednesday 28th November 2012
View Replies!

Zoom control

I`ve loaded an image in an image box and i want to be able to zoom in and out to view the image how do i do that. pliz help thanxz in advance
VIEWS ON THIS POST

83

Posted on:

Wednesday 28th November 2012
View Replies!

Web browser

hello again. are enybody know how to make visual basic 6 web browser faster whenn enybody know plase help me.....
VIEWS ON THIS POST

146

Posted on:

Wednesday 28th November 2012
View Replies!

Professional and all please help me solve this problem

all. I wanna asked to anyone who know how to solve my problem. I have created a 'Members Id collecter and viewer' Project. In form1, I have put 1 web browser, 1 command button and 1 listbox to add an Id on it automatically.. This is the first function I Tried Function GetLinks(ByRef HTML As String, _ ByRef ReturnArray() As String) As Long Dim lonRet As Long, lonstart As Long Dim lonend As Long lonRet = -1 ReDim ReturnArray(0 To 49) As String Do lonstart = InStr(lonstart + 1, HTML, " href=""", vbTextCompare) If lonstart > 0 Then lonstart = lonstart + 7 'Length of `href="` lonend = InStr(lonstart, HTML, """") If lonend > 0 Then lonRet = lonRet + 1 If lonRet > UBound(ReturnArray) Then ReDim Preserve ReturnArray(0 To lonRet + 50) As String End If ReturnArray(lonRet) = Mid$(HTML, lonstart, lonend - lonstart) lonstart = lonend End If End If Loop Until lonstart = 0 If UBound(ReturnArray) > lonRet Then ReDim Preserve ReturnArray(0 To lonRet) As String End If GetLinks = lonRet End Function Private Sub Command2_Click() Dim strCompare As String Dim intCompare As Integer Screen.MousePointer = vbHourglass strHTML = Inet1.OpenURL(WebBrowser1.LocationURL) lonLinks = GetLinks(strHTML, strLinks) If lonLinks > -1 Then 'Add links to ListBox. Dim i As Long For i = 0 To lonLinks lstlinks.AddItem Extract(strLinks(i), "member_id=", "&") Next i '-------------------------- 'remove empty list '-------------------------- For i = lstlinks.ListCount - 1 To 0 Step -1 strCompare = lstlinks.List(i) intCompare = Len(Trim(strCompare)) If intCompare = 0 Then 'if zero, it will remove it lstlinks.RemoveItem (i) End If Next i End If 'duplicate test LstDuplicate l1.Caption = "Total ID = " & lstlinks.ListCount Screen.MousePointer = vbDefault 'MsgBox lonLinks + 1 & IIf(lonLinks + 1 = 1, " link found", " links found"), vbInformation End Sub I tried to collect all the url's like http://mysite.com/index.phpmember_id='1234' in the web browser page source then find the member ID value. And, It's work ! I get many ID in the listbox. But, that is not the problem. The problem is that website has been updated. The source of that page changed to BiG BrOtHeR I'm stuck ! How can I find and add all ID from [b] to the listbox from that page[p] Hope anyone know how to solve this.
VIEWS ON THIS POST

168

Posted on:

Wednesday 28th November 2012
View Replies!

how to read a word from a dictionary file

so I have a dictionary file and all the words are typed in one line and separated by comas. So I open the file, read the line of words, and I look through all the charaters(16733 in total) for comas. If I find 2 comas, there must be a word in between the two comas, and I print it on a label. But somehow the word is not showing, can anyone help me Dim intX As Integer Dim intY As Integer Dim strOut As String Dim strIn As String Dim strLetter_2 As String Dim strLetter_1 As String Dim strWord As String Dim intCounter As Integer Private Sub Form_Load() Randomize intCounter = 0 Open "Dictionary-N1.txt" For Input As #1 Do While Not EOF(1) Line Input #1, strIn strOut = strOut & strIn Loop Close #1 Do While intCounter > 16734 And strLetter_1 "," And strLetter_2 "," intCounter = intCounter + 1 intX = Int(Rnd * 16733 + 1) intY = Int(Rnd * 16733 + 1) strLetter_1 = Mid(strOut, intX, 1) strLetter_2 = Mid(strOut, intY, 1) If strLetter_1 = "," And strLetter_2 = "," And intY > intX Then strWord = Mid(strOut, intX, (intY - intX)) lblWord.Caption = strWord ElseIf strLetter_1 = "," And strLetter_2 = "," And intX < intY Then strWord = Mid(strOut, intY, (intX - intY)) lblWord.Caption = strWord End If Loop End Sub
VIEWS ON THIS POST

88

Posted on:

Wednesday 28th November 2012
View Replies!

sending byref object problem

hello, I have a problem. I have a module that contain a public function. I send byref MSFLexGrid table. Here is my code Public Sub Reg_Save_vbalGridCols(objGrid As MSFlexGrid, ByVal aSect As String) Dim i As Long Dim str_val As String With objGrid For i = 0 To .Cols - 1 str_val = str_val & "|" & Fix(.ColWidth(i)) Next i End With SaveSetting c_REG_APP, c_REG_SETTINGS, "GRD_" & aSect, str_val End Sub so i get an error on the row "Public Sub Reg_Save_vbalGridCols(objGrid As MSFlexGrid, ByVal aSect As String)" the error is "Cant Find Project or library" and when i hit ok button References window show up. Now i was thinking if it was the version of my MSFLexGrid .OCX file but i copy the same from my other PC where the code work fine. What can be the problem. ty in advance for your help
VIEWS ON THIS POST

177

Posted on:

Wednesday 28th November 2012
View Replies!

insert table into rich text with alignments

pls i did llike richtextbox.seltext =rs.fields(1) etc
VIEWS ON THIS POST

165

Posted on:

Wednesday 28th November 2012
View Replies!

Insert javascript snippi

I whant to make a script where two input boxes will pop up and the user can insert the name and value of a cookie. The web browser will then navigate to the jascript injection java script:void(document.cookie="name=value"); with the specifics inserted in the code. I am useing visual basic express and i tried inserting values such as webbrowser1.navigate("java script:void(document.cookie="", &name, &value"");" but it couldn't handle that many arguments so i tried Dim value Dim Value2 Dim Value3 Dim Value4 value = InputBox("cookie value( ex. ""name=value"") must be in quotes:") Value2 = ("java script:void(document.cookie= " & value) Value3 = (Value2 & value) Value4 = (Value3 & ");") url.Text = (Value4) but it didn't work. i get a scripting error Any ideas or am i just in the wrong direction
VIEWS ON THIS POST

45

Posted on:

Wednesday 28th November 2012
View Replies!

Calling all VB programmers!

If anyone out there knows Visual Basic, and would be intrested in working on a project we are looking for you! Basically we need a VB programmer to construct a plug-in for Winamp. What this plugin does is outputs certain strings of song titles and artists to a page using PHP and/or XML. Since noone knows VB on our team, we really have no idea what we are talking about. If anyone is intrested you can contact me on AIM or ICQ and I can fill you in on some more details. Also, you can contact one of the other people on our team also through AIM: EkoStudios CycloMosaic WickedClown41487 or my ICQ number is 112540313.
VIEWS ON THIS POST

202

Posted on:

Wednesday 28th November 2012
View Replies!

Find Min and Max Value using VB6

im trying to get the minimum and maximum value from a text file..but it seem not work.can someone help me correct the code..thanks. Private Sub getminval_Click() 'Get Minimum and maximum Value Dim strFileName As String Dim myFile As Integer Dim strTextLine As String Dim dblX(100000) As Variant Dim dblY(100000) As Variant Dim dblZ(100000) As Variant Dim arrText As Variant Dim strName As String Dim dblPt(2) As Double Dim diffZ As Double Dim minva, maxva As Integer Dim i As Integer Dim min(100000), max(100000) As Integer strFileName = mstrinpfile myFile = FreeFile If strFileName = "" Then MsgBox "No Data ", vbOKOnly, "HydroLab File Error" Me.Show End If i = 1 min(0) = 0 max(0) = 0 Open strFileName For Input As #myFile Do While Not EOF(myFile) Line Input #myFile, strTextLine arrText = Split(strTextLine, ",") dblX(i) = arrText(0) dblY(i) = arrText(1) dblZ(i) = arrText(2) min(i) = dblZ(i) - min(i - 1) If min(i) < min(i - 1) Then minva = dblZ(i) minval.Text = minva ElseIf min(i) > min(i - 1) Then minva = dblZ(i - 1) minval.Text = minva End If max(i) = dblZ(i) - max(i - 1) If max(i) > max(i - 1) Then maxva = dblZ(i) maxval.Text = maxva ElseIf max(i) < max(i - 1) Then maxva = dblZ(i - 1) maxval.Text = maxva End If i = i + 1 Loop End Sub
VIEWS ON THIS POST

118

Posted on:

Wednesday 28th November 2012
View Replies!

Excel Macros: Loop thru row cells, counting Empties

In column B i want to locate the row number of where the 12th emptyRow is. This is my attempt to get around finding the end of a list (there are 11 blank cells at the beginning, so the 12th blank cell would be the end of the list). So if there is a better way of that, please inform me! Dim emptyRow As Integer emptyRow = 1 Do Until emptyRow = 12 If IsEmpty(Cells(emptyRow, 2)) Then ' column B emptyRow = emptyRow + 1 End If Loop ActiveCell.FormulaR1C1 = "WWWOOORRRKKK!!!!!!" ' decipher row number Thank you.
VIEWS ON THIS POST

132

Posted on:

Wednesday 28th November 2012
View Replies!

quiz application for grade 3

thanks for helping me..
VIEWS ON THIS POST

64

Posted on:

Wednesday 28th November 2012
View Replies!

I want Cargo Management System Project. Pls Help Me

Please Send me the source code and documentation for CARGO MANAGEMENT SYSTEM project. this will very much helpful to my BCA., Project. my email ID. {REMOVED} Thank you M. NAGULAN
VIEWS ON THIS POST

50

Posted on:

Wednesday 28th November 2012
View Replies!

is it possible to develop a p2p softphone using vb

can i use any of the vb software to do develop a peer to peer voip phone.Email me
VIEWS ON THIS POST

175

Posted on:

Wednesday 28th November 2012
View Replies!

Searching the records in MS-Access database using vb

I connected my Visual basic and MS-Access using Add ins manager. Please take a look below Private Sub Command6_Click() Dim n, n1 As String Dim count As Integer count = Data1.Recordset.RecordCount txtmax.Text = Data1.Recordset.RecordCount cnt.Text = 1 n = InputBox("Enter the roll no") Data1.Recordset.MoveFirst While Not Data1.Recordset.Fields(1) = n cnt.Text = cnt.Text + 1 If cnt.Text
VIEWS ON THIS POST

110

Posted on:

Wednesday 28th November 2012
View Replies!

vb6 query only returning 1 result from ms access database

Hi , im having some trouble here and cant figure out what im doing wrong. I have a vb6 program linked to a ms database and im running queries and returing the results in a listbox on the same form. here is what i have so far: Private Sub cmdSearchauthor_Click() Dim strSearchFor As String, foundFlag As Boolean 'Search for the Author specified by the user strSearchFor = UCase(InputBox("Enter the Author to find:")) If Len(strSearchFor) > 0 Then datBooks.Recordset.MoveFirst foundFlag = False Do While (Not foundFlag) And (Not datBooks.Recordset.EOF) If UCase(datBooks.Recordset.Fields("Author").Value) = strSearchFor Then foundFlag = True lstBooks.AddItem datBooks.Recordset.Fields("Title").Value Else datBooks.Recordset.MoveNext End If Loop If Not foundFlag Then MsgBox "Unable to locate requested Author.", , "Not Found" datBooks.Recordset.MoveLast 'move so that EOF is no longer true End If Else MsgBox "Must enter an Author.", , "" End If End Sub When i run this query I want it to return all of the book titles written by a certain author in the database, this query works but only returns one of the book titles by the author instead of all of them. I think there may be something wrong with my loop or something but i cant see it. can someone please tell me where im going wrong
VIEWS ON THIS POST

168

Posted on:

Wednesday 28th November 2012
View Replies!

vb form loading

In my vb project i use the code to load a form from Menu.frm: load frmApplicationmaster frmapplicationmaster.show If the form is calling form any other form without unloading, then the form is loaded but all text boxes used in the form are refreshed. How can I call the form from any other from so that it's text boxes will not be refreshed for it's previous instant. Can any body help me.
VIEWS ON THIS POST

188

Posted on:

Wednesday 28th November 2012
View Replies!

search text from saved txt file

how to search certain word in text file and display in textbox/listbox for example btnSearch click event Get the name of the file(quarry) to look for (pop up an input box) Set blnfound to false If the file exists, open it in the opentext mode do until end of file for blnfound = true Read the four fields from the file If the quarry.toupper = video_file_name.toupper then Set the blnfound to true Endif Loop Close the text file If blnfound = true then Display each field in the text boxes Else Display a message box that the text record was not found End if Else Display a message that says you cannot open the file because it doesnt exist End if
VIEWS ON THIS POST

271

Posted on:

Wednesday 28th November 2012
View Replies!

ADO data control

Private Sub Command1_Click() Dim s s = Text5.Text If Len(Trim(s)) > 0 Then s = "07software='" & UCase(Trim(s)) & "'" Adodc1.Recordset.Find s End If End Sub Private Sub Form_Load() Dim iRecords As Integer Dim strDBPath As String strDBPath = App.Path If Right(strDBPath, 1) "\" Then Me.Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Muneer\My Documents\database work\db1.mdb" End If Admin Edit: Please use code tags when posting your code. Code tags are used like so =>
VIEWS ON THIS POST

79

Posted on:

Wednesday 28th November 2012
View Replies!

VB6 find and replace issue

everybody, I have an issue with a code. I'm don't know how to start this. Here is my problem: Column 2 of my MSFlexgrid = store number. Ex: 1009,1010 etc. In column 20 of my MSFlexgrid = Delivery day. Ex: Sun, Mon, Tue......, Now if store 1009 have multiple delivery days ex: Column 2 Culumn 20 1009 Mon 1009 Fri The logic will have to be that way: If the the holiday entered in the Form4.day_ferier (Combo Box) is "Mon" Then it will calculate how many day it will have until the next delivery. In that case,Monday to Friday = 4 days. Then it will calculate how many days there was from the previous delivery. Friday to Monday = 3 days. So since Monday to Friday is bigger that Friday to monday, then the results will be Monday +1. So Tuesday. If the result would of been less, then it would of been Monday - 1. So Sunday. If it would of been equal, by default, it would be Monday - 1. Would it be easier if I change Sun by "1", Mon by "2", Tue by "3" and so on... Thank you so much for your help. This post has been edited by wilder: 01 November 2009 - 03:54 PM
VIEWS ON THIS POST

132

Posted on:

Wednesday 28th November 2012
View Replies!

searching text file for upper case text

i would like to know how to use open file dialogue to select a text file and be able to search the file and extract only the words in uper case. pliz help
VIEWS ON THIS POST

141

Posted on:

Wednesday 28th November 2012
View Replies!

If Statement

Is this right... Am i answering the question right Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim x, y, z As Double Dim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT") x = CDbl(sr.ReadLine) y = CDbl(sr.ReadLine) z = CDbl(sr.ReadLine) txtBox.Text = "Good If ((x > y) Or (x > z)) And (z >= 100) Then txtBox.Text &= "morning" Else txtBox.Text &= "evening" End If sr.Close() End Sub a. Give a set of values for the three inputs that will produce the output Good morning. X = 400 Y = 300 Z = 200 b. Change the condition in the if-block so that the output is Good morning only if exactly 1 of the three inputs is greater than 6. Write the new condition here: If ((x > y) Or (x > z)) And (z >= 6) Then txtBox.Text &= "morning" Else txtBox.Text &= "evening" End If c. Change the condition in the if-block so that the output is Good morning only if all three inputs are positive numbers or all three inputs are negative numbers. Write the new condition here: If ((x > y) Or (x > z)) And (z >= 0) Then txtBox.Text &= "morning" Else txtBox.Text &= "evening" End If
VIEWS ON THIS POST

56

Posted on:

Wednesday 28th November 2012
View Replies!

form

[/b]how to make form1 active when form2 is also active[size=5]
VIEWS ON THIS POST

51

Posted on:

Wednesday 28th November 2012
View Replies!

delete record

hi, i've been having trouble with deleting a record in a database. i'm very new to adodb, so i dont know much. welps.. this is what i have so far: Private Sub cmdDelete_Click() Dim MyConn As adodb.Connection Dim rs As adodb.Recordset Set MyConn = New adodb.Connection MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\List1.mdb;" MyConn.Open If MsgBox("Are you sure you want to delete this record", vbYesNo + vbQuestion, "Delete") = vbNo Then 'check if you really want to delete this record Exit Sub Else With MyConn .BeginTrans .Execute "DELETE FROM List1 WHERE OrigTitle = '" & ListView1.ListItems.Item(ListView1.SelectedItem.Index) .CommitTrans End With End If rs.Close Set rs = Nothing how come this doesnt work i get an error saying Syntax error in string query expression 'OrigTitle = 'whatever'. where 'whatever' is what the user selects in the first column of the ListView. it then points to: .Execute "DELETE FROM List1 WHERE OrigTitle = '" & ListView1.ListItems.Item(ListView1.SelectedItem.Index) so can anybody help me out with this or give any other advise on how to delete a record many
VIEWS ON THIS POST

165

Posted on:

Wednesday 28th November 2012
View Replies!

how could I run a console app inside a windows application VB.nET

Could someone help me regarding with this problem\t I need to run my console program which is made in vb.net where I will use my windows forms to run the console app\t I have done this but it doesn't work... ... Private Sub Button1_Click(ByVal......) Call Module1.Main() //where my Module1 is the name of my console application. End Sub I've tried to add as Existing Item or Project but it doesn't work... Please explain to me why.. Please help me with this one to finish my exercise...
VIEWS ON THIS POST

160

Posted on:

Wednesday 28th November 2012
View Replies!

Can't Get DataGridView to Update Access Database

Folks, First time poster! Woo! Fisrt off, I'm not doing this for any school and I'm very very new to this. This is a hobby I'm trying to pick up (I'm sure yall have heard that before though.) Anywho, I'm using VB 2008 Express Edition and Access 2000. I made a databse in access with one table. Two columns in the table. The primary key - ID(auto nunber) and a field I just named "hello"(text). I used the databse connect wizard to connect to the databae. Added the databse object and VB put in any needed code. I put a DataGridView on the form and draged and dropped Table1 over the DataGridView. I made a command button and here is the code I put in it: Me.Validate() Me.Table1TableAdapter.Update(Me.Db3DataSet.Table1) Me.Db3DataSet.AcceptChanges() The thing is it will update the DataGridView fine. I can close VB and re-open it and the changes are still there. But if I open up the access file no changes are made. Any ideas as to what I am missing I would really appreciate any help.
VIEWS ON THIS POST

58

Posted on:

Thursday 29th November 2012
View Replies!

Filtering an excel sheet based on listbox selections

Topics merged, please don't create duplicate topics
VIEWS ON THIS POST

125

Posted on:

Thursday 29th November 2012
View Replies!

Global Variables

I am a java programmer trying to learn VB. Question! How do I declare a Global variable Java is : public static int num = 0 public static void main(String args[]) { num } VB6: Dim num As Integer = 0 this is where in need the help I want to set num to a value out side my function
VIEWS ON THIS POST

46

Posted on:

Thursday 29th November 2012
View Replies!

help in login code

could someone help me fix this code....it shows userdata form even if name and password do not match i need immediate help.....thanks Private Sub login_Click() If adname.Text = Adodc1.Recordset.Fields("Administrator Name").Value And Adodc1.Recordset.Fields("Password").Value = adpassword.Text Then welcome_ad.Hide userdata.Show Exit Sub Else userdata.Hide welcome_ad.Show End If End Sub
VIEWS ON THIS POST

196

Posted on:

Thursday 29th November 2012
View Replies!

Visual Basic 2005 EE vs Visual Basic 2005

Whats the difference between the two. I heard from this guy at a Computer Store who said that the full version costed around R3000(ZAR (go to xe.com for a conversion)) and i here from a friend that the debuggers just a bit better and that there are a few more commands. but i don't see much of a difference between the two. right now i am working in The Express Edition(EE) and it works just fine for me. so is the full version worth the buy.
VIEWS ON THIS POST

74

Posted on:

Thursday 29th November 2012
View Replies!

VB6 IDE crashes on exiting debugger

My VB6 IDE will crash when I exit the debugger if I have changed any data in the application. This crash occurs both with programmatic exit, the "X" and the debug end control. The exit will usually have an error associate data at 77D etc could not be written to.... and someother memory address. I have installed the sp6 update as well as the mousewheel and the last security update. Assistance will be much appreciated
VIEWS ON THIS POST

101

Posted on:

Friday 30th November 2012
View Replies!

invalid data source

i made an small package in vb6. 1--> when i install my package in other computer while printing report caption view "invalid data source" I attach my project with this mail . 2 --> In package i want saperate font that my organization wants how i added in package. Plese Help me as soon as possible with source code & package. Attached File(s) Indent.zip (250.67K) Number of downloads: 42
VIEWS ON THIS POST

184

Posted on:

Friday 30th November 2012
View Replies!

Where can i download VB6 ?

Does anybody know where i can download VB6 \t
VIEWS ON THIS POST

151

Posted on:

Friday 30th November 2012
View Replies!

OUT OF MEMORY ERROR VB6 CRYSTAL REPORTS 8

I had a working program printing reports written in VB 6 and printing data through crystal reports 8. in january the report function stopped working, when stepping through code i get error 20500, not enough memory. I have re-formatted and re-installed all the app's. I still get same error. the report works on other computers. I checked Dll with crystal utiliy, all looks good..any help would be appreciated. it appears lots of people have this problem. I havent come across the right answer yet. Is it possible, there is a certain way the the computer has to be loaded. i.e..xp, office, vb6 then xtal or does it matter.
VIEWS ON THIS POST

181

Posted on:

Friday 30th November 2012
View Replies!

VB Project

Ok I solved that problem, here is my new code. Option Strict On Public Class Form1 'Declare module-level constants. Const BONUS_PERCENT_Decimal As Decimal = 0.02D Const FOUR_WEEK_Integer As Integer = 160 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintForm1.Click 'Calculate the bonus earned by each employee Dim SalesDecimal, HoursDecimal, BonusDecimal As Decimal Try 'Convert store sales if valid input SalesDecimal = Decimal.Parse(SalesTextBox.Text) Try 'Convert hours if valid input HoursDecimal = Decimal.Parse(HoursTextBox.Text) 'Calculate and display the bonus BonusDecimal = (HoursDecimal / FOUR_WEEK_Integer) * (SalesDecimal * BONUS_PERCENT_Decimal) BonusTextBox.Text = BonusDecimal.ToString("C") Catch HoursException As FormatException 'Handle the number of hours MessageBox.Show("Hours must be numeric data.", "Invalid Input", _ MessageBoxButtons.OK, MessageBoxIcon.Error) With HoursTextBox .Focus() .Select() End With End Try Catch SalesException As FormatException 'Handle the amount of sales MessageBox.Show("Sales must be numeric data.", "Invalid Input", _ MessageBoxButtons.OK, MessageBoxIcon.Error) With SalesTextBox .Focus() .Select() End With Catch AnException As Exception MessageBox.Show("Error: " & AnException.Message) End Try End Sub Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click 'Clear the form HoursTextBox.Clear() BonusTextBox.Clear() With NameTextBox .Clear() .focus() End With End Sub Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click 'End the program Me.Close() End Sub Private Sub PrintButton_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click 'Print the form PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview PrintForm1.Print() End Sub End Class and here are my errors: Error 1 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 48 103 jps27 Error 2 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 59 102 jps27 Error 3 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 65 103 jps27 Error 4 'PrintAction' is not a member of 'System.Windows.Forms.Button'. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 68 9 jps27 Error 5 'Print' is not a member of 'System.Windows.Forms.Button'. H:\Visual Studio 2008\Projects\VB Mail Order 1\jps27\jps27\Form1.vb 69 9 jps27
VIEWS ON THIS POST

54

Posted on:

Friday 30th November 2012
View Replies!

Just started

there I just started programming at college, they said that we could download the express version off the microsoft website, does that mean that i am learning VB or VB.net, Its just that we started today, so no coding as of yet(otherwise i know what we were doing) Just wanted to get a head start on else
VIEWS ON THIS POST

46

Posted on:

Friday 30th November 2012
View Replies!

vb6 shopping cart receipt

Im wondering if anyone has a suggestion on this or some useful reference or something. I'm designing a convenience store system. The products are selected via computer. I'm not sure how I should go about getting each individual selection to be added to the final receipt. The way I have it now, the products are by categories, so when they are selected i do a subtotal and this is place on the category label in the receipt. Is there a way that I can have each item placed on the receipt from when it's clicked in its particular category I thought of placing labels, then i realised I won't know for sure how the items should be placed because of the order in which they're selected, or what if one isnt selected. I can leave it as it is now, with just the subtotals. But I was thinking it might be good to have all the items there. I was using this VB6 book by Julia Bradley but it doesnt give insight for this problem. Any suggestions or ideas
VIEWS ON THIS POST

230

Posted on:

Friday 30th November 2012
View Replies!

Sendkeys to Remote Desktop

Hi Everyone, I would like to know, Whether is it possible to send some keystrokes randomly to a remote PC Application, which can be accessed by an MSTSC or any other Remote Desktop Manager Application. Need : I need to Pick some data from my database which is located at the local computer, (My System) and Paste it in an Application (Windows based) which is in some other system where the Login details are Known to me. I will be greatful if I can get the details of this asap. I prefer VB / VB Dot Net Windows Based Application. it Doesnt matter If it is Script
VIEWS ON THIS POST

71

Posted on:

Friday 30th November 2012
View Replies!

Listview Help!

How does one add info into a listview from the top instead of adding to the bottom frmMain.lvCF.SortOrder = lvwAscending frmMain.listview.ListItems.Add frmMain.lvCF.ListItems.Count + 1, , sUsername, , ClientFlag frmMain.listview.ListItems(frmMain.lvCF.ListItems.Count).ListSubItems.Add , , lPing, , lPing this code doesnt work the way i want it to ( its alphabetic ) please help me
VIEWS ON THIS POST

52

Posted on:

Friday 30th November 2012
View Replies!

Opening new window in VB browser...how to?

! Im a newbie here, recently im programming PHP for web based approach and i've been using ready made browser like firefox as my application. But now im switching it to custom browser with visual basic. I've created my own custom browser and it seems ok. but my question here is, how to open up a new browser (new VB browser window) as same as we open a new browser in firefox. I've been using html code that opens new window, but it open up explorer browser instead and it took very long time to open. I want it to open up as VB browser with my php codes inside. Is there any html or php code that could open new vb browser window instead of explorer or firefox window.
VIEWS ON THIS POST

68

Posted on:

Friday 30th November 2012
View Replies!

how can i make a snake game in visual basic 6.0?

help me plzz.. .. how can i make a snake game in visual basic 6.0 .. .. thnx .. .. kip up .. ** Edit ** Removed E-mail
VIEWS ON THIS POST

71

Posted on:

Friday 30th November 2012
View Replies!

Declare variables to work in numerous forms

OK simple question can i declare variables in one place so that they can be used in multiple forms. In other words so i dont have to declare them on every form. Say for eample I have a text box and its retrieving its value from an outside interface. the variable is continuously changing. I have 3 forms, and on each one i have to declare the same variables for my code and setup the connection to my interface. Can I not set the code up in such a way that when it loads all forms work from it\t
VIEWS ON THIS POST

169

Posted on:

Friday 30th November 2012
View Replies!

Editing access tbls from outside using MSVBA

Ok, so I'm relearning all of this without actually working in Access. I'm currently trying to use some codes that I used to use in Access but can't quite figure out the right syntax. Here's what I have Private Sub Command1_Click() Dim cn As adodb.Connection Dim rs As adodb.Recordset Dim PF As New Public_Functions Dim mytry As String Set cn = New adodb.Connection cn.Open "provider=microsoft.jet.oledb.4.0; " & _ "Data Source=V:\Information Technology\Development\Rich Code\Programs\Jimmy\Programs\my mcp\_NewMCP 3.0(BETA)\TEST.MDB" mytry = "DELETE * FROM Tbl1" cn.Execute (mytry) Set rs = cn.Execute("SELECT * FROM Tbl1") End Sub That works great but now when I use a file dialog to select my file, how do I import it to the database In Access I used to use DoCmd.TransferText ACImportDelim, blah blah blah But I can't quite figure out how to implement this....do I save it in a string then use excecute or is there a better way As always,
VIEWS ON THIS POST

70

Posted on:

Monday 3rd December 2012
View Replies!

display the letter grade based on the average test scores

how to code the application that displays the letter grade based on the average of three test scores. here is what i came up with but it is not working Public Class frmMain Private Function CalculateGrade _ (ByVal testScore1 As Decimal, ByVal testScore2 As Decimal, _ ByVal testScore3 As Decimal) As String Dim AverageScore As String Dim strLetterGrade As String Dim intNum1 As Integer Dim intNum2 As Integer Dim intNum3 As Integer Dim intNum4 As Integer AverageScore = testScore1 + testScore2 + testScore3 / 3 strLetterGrade = {"A", "B","C", "D", "F"} intNum1 = 90 intNum2 = 80 intNum3 = 70 intNum4 = 60 If AverageScore >= 90 Then Return strLetterGrade("A") Else If AverageScore >= 80 Then Return strLetterGrade("B") Else If AverageScore >= 70 Then Return strLetterGrade("C") Else If AverageScore >= 60 Then Return strLetterGrade("D") Else If AverageScore < 60 Then Return strLetterGrade("F") End If End If End If End If End If Return strLetterGrade End Function Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub txtTest1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTest1.KeyPress ' allows the text box to accept only numbers, the period, and the Backspace key If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar "." _ AndAlso e.KeyChar ControlChars.Back Then e.Handled = True End If End Sub Private Sub txtTest2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTest2.KeyPress ' allows the text box to accept only numbers, the period, and the Backspace key If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar "." _ AndAlso e.KeyChar ControlChars.Back Then e.Handled = True End If End Sub Private Sub txtTest3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTest3.KeyPress ' allows the text box to accept only numbers, the period, and the Backspace key If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar "." _ AndAlso e.KeyChar ControlChars.Back Then e.Handled = True End If End Sub Private Sub txtTest1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTest1.TextChanged lblGrade.Text = String.Empty End Sub Private Sub txtTest2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTest2.TextChanged lblGrade.Text = String.Empty End Sub Private Sub txtTest3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTest3.TextChanged lblGrade.Text = String.Empty End Sub Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click End Sub End Class This post has been edited by modi123_1: 19 November 2010 - 09:26 PM Reason for edit:: please remember your code tags..
VIEWS ON THIS POST

89

Posted on:

Monday 3rd December 2012
View Replies!

Establish points around a compass or clock

Is there an oft-used algorithm that generates the points around a circle like a clock or compass at a defined radius A clock has 12 numbers so 360 / 12 = 30 degrees. 30 degrees is a 0.5 factor and 60 degrees is 0.866 factor (45 degrees is 0.707). I want to create a 8, 10 and 12 segmented ring. I will show my start on an 8 segment ring. CenX and CenY are the coordinates at the center and RingSRad is the ring's radius. Am I on the right track here Rem 8 Rem y,0 Rem .707,.707 Rem x,0 Rem .707,.707 Rem -y,0 Rem -.707,-.707 Rem -x,0 Rem -.707,-.707 coords(1, 1) = CenY + RingSRad coords(1, 2) = CenY + RingSRad * 0.707 coords(1, 3) = CenX + RingSRad coords(1, 4) = CenX + RingSRad * -0.707 coords(1, 5) = CenY - RingSRad coords(1, 6) = CenY - RingSRad * 0.707 coords(1, 7) = CenX - RingSRad coords(1, 8) = CenX - RingSRad * -0.707 This post has been edited by Rhymer: 12 January 2010 - 02:41 PM
VIEWS ON THIS POST

66

Posted on:

Sunday 23rd December 2012
View Replies!

Adding multiple text to a label?!

I have a question: Is it possible to add multiple texts or info to one label I mean for example i have 3 command buttons and from all of them i get a text message in label when i press them. But normally when you press the second command button the first text (text from the first commant button) automatically deletes itself. And second text (text from the second command button) appears in the label. So is there a possibility to combine texts together, without deleting the previous text P.S I'm a newbie! This post has been edited by phoeniX_: 04 August 2009 - 11:11 AM
VIEWS ON THIS POST

66

Posted on:

Sunday 23rd December 2012
View Replies!

load item to combobox

Private Sub comboselection() Dim rs1 As New ADODB.Connection rs1.Open "select ID from Employee", mycon, adOpenDynamic, adLockBatchOptimistic Combo1.Clear If Not rs1.EOF Then Do Until rs1.EOF Combo1.AddItem rs1(ID) Loop End If End Sub Error msg is not define ID variable Whats wrong with this code i called this one from form load
VIEWS ON THIS POST

62

Posted on:

Monday 24th December 2012
View Replies!