SEARCH YOUR SOLUTION HERE  

Right$ doesn't work

A project in VB6 recently worked without any problems but now it's complaining when I try to use 'Right$'. In immediate mode, when I'm typing 'print left$("123456",2)' I get the correct result '12'. When I type 'print right$("123456",2) I ...

Posted On: Sunday 11th of November 2012 10:26:10 PM Total Views:  199
View Complete with Replies




Related Messages:

how to right click an image?   (264 Views)
so far i have control if you left click on an image because that is default in your form but how do i make it so there can be programming if i right click it
How to copy files with Administrator's right   (206 Views)
everybody , When I write VB6 program , I need to copy files to C:\Windows. But always fail as I don't have Administrator's Right. I found a program on web but also fail : Option Explicit Private Sub Command1_Click() Const ssfDESKTOP = 0 Const ssfWINDOWS = 36 Dim OriginalFile As String Dim CopiedFile As String Dim F As Integer With CreateObject("Shell.Application") With .NameSpace(ssfDESKTOP).Self OriginalFile = .Path & "\test-orig.txt" End With With .NameSpace(ssfWINDOWS).Self CopiedFile = .Path & "\test-copy.txt" End With End With F = FreeFile(0) Open OriginalFile For Output As #F Print #F, "Testing!" Close #F DoEvents FileCopy OriginalFile, CopiedFile Kill OriginalFile MsgBox FileLen(CopiedFile) End Sub Please help me.
How to prevent admin-rights for registering activex component?   (271 Views)
I currently developed a Outlook addin (with VB6) that uses Redemption- Objects. Now I need to run this with only user-rights. As registering redemption.dll using regsvr32 runs fine even with simple user-rights, registering my own activex addin results in ...
Add Edit Delete Options on right click in MSFlexGrid Control VB6   (197 Views)
Hi: Can any one please tell me how to enable a right click option in MSFlexGrid Control. I mean when user right click in any grid row, it ask option Add, Edit, Delete and when user click on any one ...
Tree View - right click   (244 Views)
Does anyone have any code that lets me right click in my treeview windows and then I want to add nodes or delete nodes...etc. Basically, I do not know the code how to get VB to recognize a rightclick having ...
Data file encryption -- program sales -- copyright protection   (220 Views)
I am writing code for a friend of mine. We may want to sell it. The demo version will have a few data files in sub folders with a TXT extension. If the prospective buyers want to, they can add ...
adding to the right click menu?   (287 Views)
There is a program called "FileNote" that adds itself to the right click menu of a file. (You right-click on the filename of a file, and FileNote is an option on the drop-down menu). Anyone know how to do that ...
How to avoid the right mouse button on the BrowseForFolder window   (299 Views)
I use the BrowseForFolder function to let the user searching some files. The function is quite good but I don't like that the message 'What's This' appears if you press the right mouse button on the BrowseForFolder window. To avoid ...
HELP : right to left property   (331 Views)
My VB6 project is prepared and compiled on my machine. Right to Left Property has been set to true on all forms. all Menus are showing Right aligned. When I install the application on other computer, the Right to ...
More effecient way to right string array to file?   (173 Views)
I currently have a substantially large string array (Str_Output), and am writing it to a file in the current matter: For Int_Loop = 1 to Ubound(Str_Output) Bin_KeyFile2.Write(Str_Output(Int_Loop)) Next This is obviously writing the array 1-byte at a time, thus is ...
What is the right procedure for a combo box   (242 Views)
I'm trying to use a combo box but if I use dropdown for the procedure it doesn't work right. I have the 4 items in the list of the comb box ok, but as soon as you hit the ...
[vb.net] User access rights in Application   (427 Views)
I'm trying to find out the best way to control the access rights for several users that work with data stored in a database.. Updating certain fields have to be made unaccessible (read only) for users with the lowest ...
NEED HELP - Reviewing a piece of VB code that should be doing the right thing...   (396 Views)
I have a ASP.NET class library, called cl_TLR. I have a single page with a code behind file. I don't understand why my stored procedures is not returning the deed results: Here is the stored procedure information from my SQL developer: This stored procedure has several inputs and will return all the service names in the Operations Service record for that tag number and facility abbreviation. --Input Parameters tag_number char(11) facility_abbr char(2) --Output Parameters return_code Int Value= 0 - Success -302 - facility_abbr parameter is invalid -317 - tag_number parameter is invalid service_name varchar(20) ---------- Here is the code from the class library, cl_TLR: 1 Public Shared Sub GetOperationsService(ByVal Tag As String, ByVal Fac As String, ByVal dsGetOperationsService As DataSet, _ 2 ByVal rcGetOperationsService As Integer) 3 ' Setup the connection to the database 4 Dim sqlConnTempLeakRepair As New SqlConnection() 5 sqlConnTempLeakRepair.ConnectionString = ConfigurationManager.ConnectionStrings("cnTempLeakRepair").ConnectionString 6 ' Establish the command instance; define it as a stored procedure; and identify the stored procedure to use 7 Dim cmd As New SqlCommand() 8 cmd.Connection = sqlConnTempLeakRepair 9 cmd.CommandType = CommandType.StoredProcedure 10 cmd.CommandText = "usp_GetOperationsService" 11 12 ' Create a SqlParameter for each parameter in the stored procedure. 13 Dim paramTagNumber As New SqlParameter("@tag_number", SqlDbType.Char, 11) 14 paramTagNumber.Direction = ParameterDirection.Input 15 paramTagNumber.Value = Tag 16 cmd.Parameters.Add(paramTagNumber) 17 18 Dim paramFacilityAbbr As New SqlParameter("@facility_abbr", SqlDbType.Char, 2) 19 paramFacilityAbbr.Direction = ParameterDirection.Input 20 paramFacilityAbbr.Value = Fac 21 cmd.Parameters.Add(paramFacilityAbbr) 22 23 ' Create a dataadapter, dataset, and fill the dataset 24 'Dim dsGetTLRData As New DataSet 25 Dim daGetOpsData As New SqlDataAdapter(cmd) 26 sqlConnTempLeakRepair.Open() 27 daGetOpsData.Fill(dsGetOperationsService, "tbldaGetOpData") 28 sqlConnTempLeakRepair.Close() 29 30 'Check the return code 31 Dim returncodeGetOperationsService As Integer 32 returncodeGetOperationsService = dsGetOperationsService.Tables("tbldaGetOpData").Rows(0).Item("return_code") 33 'Get the row count of the dataset 34 rcGetOperationsService = dsGetOperationsService.Tables("tbldaGetOpData").Rows.Count() 35 End Sub ---------- Here is the code-behind for the ASPX page: 1 Imports System.Data 2 Imports System.Data.SqlClient 3 Partial Class Operations_operationsservice 4 Inherits System.Web.UI.Page 5 6 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 7 Dim dsOpList As New DataSet 8 Dim counter As Integer 9 cl_TLR.GetOperationsService("01250", "es", dsOpList, counter) 10 Session("sesCounter") = counter 11 lblReturnCode.Text = counter 12 If counter > 0 Then 13 grid.DataSource = dsOpList 14 grid.DataBind() 15 End If 16 17 End Sub 18 End Class ---------- Here is the ASPX front-code: 1 2 3 4 5 6 7 Untitled Page 8 9 10 11 12 13 14 15 16 17 ---------- I'vetestedthestoredprocedureout(usingQueryAnalyzer)anditworkslikeacharm. I'vealsotestedthecodeoutwhenitwasinthecodebehindfileanditwasfineaswell.Justforkick'sI'mreturningthereturncodewhenIfireoffthepage-itgivemeasuccessfulcodeof'0',butyetthedataiscomingintothedataset(intheclassfile). Thegridgenerateatableoftwocolumnsreturn_codeandservice_name. AM I MISSING SOMETHING HERE! HELP!
copyright issue + thanks...   (278 Views)
Thanks a lot Randy, I'll try this solution. There may, however, be a copyright problem as the code is to be included in a distributed application (software package for ****ysis of nucleotide and protein sequences, www.seqtools.dk ) which seems to ..
MSDN Library doesn't look right   (348 Views)
Does anyone have the following problem with their help. If I hightlight a keyword in VB6, it goes to the appropriate help page, but the "Example", "Applies to", etc on the top don't show. It just shows little misformed boxes ...
Calculation is not being done right   (216 Views)
I tried stepping in, debug but i cant seem to get this calculate the price, shipping and handling right in summary Groupbox. any help you can provide will be greatly appreciated. thanks 'Project Name: 'Programmed by: 'Date: 'Description: This form allows user to calculate the amount due for an order. ' It also calculates the taxes and shipping that customer needs to ' based on their location, products weight and taxes. Public Class VBMail 'Declare Module Level Constants Const STATE_TAX_Decimal As Decimal = 0.08D 'Declare Module Level Variables for summary informatoin Private ItemAmountDecimal, TotalAmountDueDecimal, PriceDecimal, TotalDueDecimal As Decimal Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click 'Add the quantity, weight, and price to total summary group box. Dim TaxDecimal, WeightDecimal, AmountDueDecimal, TotalWeightDecimal, QuantityDecimal As Decimal 'Validate the field to make sure there is no input error Try QuantityDecimal = Decimal.Parse(QuantityTextBox.Text) PriceDecimal = Decimal.Parse(PriceTextBox.Text) WeightDecimal = Decimal.Parse(WeightTextBox.Text) ''Calculate Price of item & Add items to the toal charges but dont display AmountDueDecimal += PriceDecimal * QuantityDecimal TotalWeightDecimal += QuantityDecimal * WeightDecimal 'Calculate Tax if being shipped to CA 'If StateTextBox.Text.ToUpper = "CA" Then 'TaxDecimal = AmountDueDecimal * STATE_TAX_Decimal 'Else 'TaxDecimal = 0 'End If 'Clear text boxes. PriceTextBox.Text = "" QuantityTextBox.Text = "" WeightTextBox.Text = "" ProductTextBox.Text = "" 'Disables the customer info after items have been added CustomerNameTextBox.Enabled = False AddressTextBox.Enabled = False CityTextBox.Enabled = False StateTextBox.Enabled = False ZipcodeTextBox.Enabled = False Catch QuantityException As FormatException MessageBox.Show("Quantiy Must be numberic.", _ "Data Entry Error", MessageBoxButtons.OK, _ MessageBoxIcon.Information) With QuantityTextBox .Focus() .Select() End With End Try End Sub Private Sub UpdateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateButton.Click Dim AmountDueDecimal, TotalWeightDecimal, HandlingDecimal, TaxDecimal, WeightDecimal, _ TotalShippingDecimal, TotalShippingandHandlingDecimal As Decimal Dim QuantityInteger As Integer Try 'Calculate the summary of the Sale 'Amount Due in summary box ItemAmountDecimal = AmountDueDecimal 'Handling Charge Table Select Case WeightDecimal Case Is 100 HandlingDecimal = 5D Case Else HandlingDecimal = 0D End Select 'Calculate Handling Charges TotalWeightDecimal = QuantityInteger * WeightDecimal 'Calculate the Shipping Charges TotalShippingDecimal = TotalWeightDecimal * 0.25D 'Calculate Total Shipping and Handling Charges TotalShippingandHandlingDecimal = TotalWeightDecimal + TotalShippingDecimal 'Calculate Total Charge TotalAmountDueDecimal = AmountDueDecimal + TotalShippingandHandlingDecimal + TaxDecimal Catch ex As FormatException End Try PriceTextBox.Text = PriceDecimal.ToString("C") AmountDueTextBox.Text = AmountDueDecimal.ToString("C") SaleTaxTextBox.Text = TaxDecimal.ToString("C") ShippingTextBox.Text = TotalShippingandHandlingDecimal.ToString("C") TotalDueTextBox.Text = TotalAmountDueDecimal.ToString("C") End Sub Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click 'Clear The date from the Screen ProductTextBox.Clear() QuantityTextBox.Clear() WeightTextBox.Clear() PriceTextBox.Clear() End Sub Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click 'Print the form on the Printer. PrintForm1.PrintAction = Printing.PrintAction.PrintToFile PrintForm1.Print() End Sub Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click 'Closes the program Me.Close() End Sub End Class Attached image(s)
moving through a spreadsheet left to right as opposed to top to bottom   (289 Views)
So, this is dumb and I'm probably missing the obvious but it's been a long week and this is bothering me. I have a macro that loops through a spread sheet. it goes top row to bottom row then left to right in each row. I understand how it loops through the rows but I'm not quite sure how it's told to work through each cell in the row. Sub QuoteCommaExport() ' Dimension all variables. Dim DestFile As String Dim FileNum As Integer Dim ColumnCount As Long Dim RowCount As Long Dim NumCols As Long NumCols=67 For ColumnCount = 1 To NumCols Columns(ColumnCount).EntireColumn.AutoFit Next ' Prompt user for destination file name. DestFile = InputBox("Enter the destination filename" _ & Chr(10) & "(with complete path):", "Quote-Comma Exporter") ' Obtain next free file handle number. FileNum = FreeFile() ' Turn error checking off. On Error Resume Next ' Attempt to open destination file for output. Open DestFile For Output As #FileNum ' If an error occurs report it and end. If Err 0 Then MsgBox "Cannot open filename " & DestFile End End If ' Turn error checking on. On Error GoTo 0 Selection.Columns.AutoFit ' Loop for each row in selection. For RowCount = 1 To Selection.Rows.Count ' Loop for each column in selection. For ColumnCount = 1 To NumCols ' Write current cell's text to file with quotation marks. Print #FileNum, """" & Trim(Selection.Cells(RowCount, _ ColumnCount).Text) & """"; ' Check if cell is in last column. If ColumnCount = NumCols Then ' If so, then write a blank line. Print #FileNum, Else ' Otherwise, write a comma. Print #FileNum, ","; End If ' Start next iteration of ColumnCount loop. Next ColumnCount ' Start next iteration of RowCount loop. Next RowCount ' Close destination file. Close #FileNum End Sub So as you can see numcols is a number but I don't see where we are telling the sheet to loop throught the columns instead of the rows. Like I said, long week. If someone could explain this to me, that would be much appreciated.
need help on going left or right in vb   (296 Views)
I'm making a board game using vb09 for an assignment , and now I'm stuck. I'm trying to make a messagebox appear and gives an opion to go left or right when they reach a certain box. Anybody has a solution
moving through a spreadsheet left to right as opposed to top to bottom   (293 Views)
So, this is dumb and I'm probably missing the obvious but it's been a long week and this is bothering me. I have a macro that loops through a spread sheet. it goes top row to bottom row then left to right in each row. I understand how it loops through the rows but I'm not quite sure how it's told to work through each cell in the row. Sub QuoteCommaExport() ' Dimension all variables. Dim DestFile As String Dim FileNum As Integer Dim ColumnCount As Long Dim RowCount As Long Dim NumCols As Long NumCols=67 For ColumnCount = 1 To NumCols Columns(ColumnCount).EntireColumn.AutoFit Next ' Prompt user for destination file name. DestFile = InputBox("Enter the destination filename" _ & Chr(10) & "(with complete path):", "Quote-Comma Exporter") ' Obtain next free file handle number. FileNum = FreeFile() ' Turn error checking off. On Error Resume Next ' Attempt to open destination file for output. Open DestFile For Output As #FileNum ' If an error occurs report it and end. If Err 0 Then MsgBox "Cannot open filename " & DestFile End End If ' Turn error checking on. On Error GoTo 0 Selection.Columns.AutoFit ' Loop for each row in selection. For RowCount = 1 To Selection.Rows.Count ' Loop for each column in selection. For ColumnCount = 1 To NumCols ' Write current cell's text to file with quotation marks. Print #FileNum, """" & Trim(Selection.Cells(RowCount, _ ColumnCount).Text) & """"; ' Check if cell is in last column. If ColumnCount = NumCols Then ' If so, then write a blank line. Print #FileNum, Else ' Otherwise, write a comma. Print #FileNum, ","; End If ' Start next iteration of ColumnCount loop. Next ColumnCount ' Start next iteration of RowCount loop. Next RowCount ' Close destination file. Close #FileNum End Sub So as you can see numcols is a number but I don't see where we are telling the sheet to loop throught the columns instead of the rows. Like I said, long week. If someone could explain this to me, that would be much appreciated.
Blackjack program's dealer isn't working right?   (284 Views)
well firstly when your player clicks the button "Hits" the following code is executed Do i1 = Int(Rnd * 51) For i = 0 To 10 'check for all 10 player cards If i1 = PlayerCurrentCardsIndex(i) Then _ goAhead = False Else goAhead = True Next i Loop While goAhead = False really the do loop is unecessary and odd how somehow it actually manages to exit if the player does not current have a card of the value i1 secondly how does this take into account that there are 4 5's in a deck checkgamelost umm doesnt take into account that if the dealer has 21 in more cards he wins whats going on here For i = 10 To 51 'buff = buff & vbCrLf & imgCard(i).Tag Next 'MsgBox buff fucking am i allowed to swear on this forum O.o If Val(lblPoints(0)) > 21 Then Sleep 1000 ExMsgBox "Dealer's point is greater than 21, it is: " & lblPoints(0), True Money = Money + Val(frmBet.lblTotal.Caption) * 2 'gonna change to beT Form_Load 'restart Exit Sub ElseIf Val(lblPoints(0)) = 21 Then Sleep 1000 ExMsgBox "Dealer's point is equal to 21", False Form_Load 'restart Exit Sub you need to do as you did in the following else if Val(lblPoints(0).Caption) this is your only behaviour code for your dealer which only occurs after the first check so really... remove the first check because you have already had money change hands / form reloading based on all the players cards vs the dealers first 2 cards Do rand = Int(Rnd * 10) + 1 If rand < 3 Then 'whether computer choose hits is chanced 2 in 10....! Hit4Dealer 'pull another card If Val(lblPoints(0)) > 21 Then Exit Sub 'did we lose the game If Val(lblPoints(0)) = 0 Then Exit Sub End If i = i + 1 Loop Until i > 5 and again with the Val(lblPoints(0).Caption) not fucking Val(lblPoints(0)) = Val(lblPoints(0).Caption) Then While Val(lblPoints(0).Caption) < 17 Hit4Dealer WEnd End If 'as long as he has less than 17 he will keep drawing cards unless he has more than the player 'you dont need to to check if he has over 21 ' until after all actions are finished 'maybe you want to add something like if the player has above 20 or 21 the dealer will draw if he has 19 or below If Val(lblPoints(1).Caption) > 19 And Val(lblPoints(0).Caption) < 20 Then Hit4Dealer End If 'Now do the check for win tie or loss ok goodluck This post has been edited by luigiplumbersinc: 17 February 2009 - 09:48 PM