Convert A Delphi Copy Operation To A .Net Substring Operation?
Jan 4, 2012
I'm trying to convert code from Delphi to .Net. I'm stuck on one line:
//Delphi code ss := Copy(ss, Length(ss), 1) + Copy(ss, 1,Length(ss) - 1); 'vb.net code ss = ss.Substring(0, ss.Length - 1) + ss.Substring(1, ss.Length - 1)
Delphi combines the two substrings, while .Net just concatenate them like a copy.
View 2 Replies
ADVERTISEMENT
Jan 3, 2012
This is the Delphi code I'm trying to convert to .net:
s1 := Copy ( s1 , 1,x - 1) + Copy(s1, x + 1,Length(s1));
I tried:
s1 = s1.Substring(x - 1, 1) + s1.Substring(s1.Length, x + 1)
But I get error's when the index is out of range. in Delphi it works fine.
Added one line to convert..
s2 := s2 + chr(3);
View 1 Replies
Feb 12, 2010
How i can prevent the operation of more than one copy of the program at the same time.
View 9 Replies
Dec 28, 2010
I need to know the time elapsed during this copy paste operation and then show it to the user
[Code]...
View 11 Replies
Nov 10, 2009
I get to convert a Delphi application to VB.Net.My last project i had to convert a Java app to VB.Net.Anyway I have most of the application converted however there are a few items that i have been unable to find the .Net equivalent. Most are from the Delphi. Sysutils class.
TSearchRec
FindFirst/FindNext/FindClose
faAnyfile[code].....
View 5 Replies
Apr 15, 2012
I have an old program from 2002, which was coded in Delphi 7. Now i would like to rewrite the whole program, and expand in Visual Basic. how to convert my old code to VB2010? The code is very simple. I fill a database with Comboboxes and TextBoxes .Text. [Code]
View 2 Replies
Nov 21, 2010
I am working on Some USB reader device..i got only delphi 7.0 example code...i can able to understand some code remaining cant so below is that code.
function ReadCard(fUSB:Byte;Buffer:PChar):Integer; stdcall;
external 'proRFL.DLL';
function GetDLLVersion(sDllVer:PChar):Integer; stdcall;
external 'proRFL.DLL';
[CODE]...
View 7 Replies
Jan 26, 2012
I am having two constants of 64 byte (X,Y) string type and a structure of 64 bytes with 5 parameters of different sizes like(1,7,12,20,14,10) no i have to xor operation with these three and store in a binary file. X XOR Y XOR Structure. the structure will be formed by taking user input values.
View 2 Replies
Feb 22, 2010
See where my vb.net equivalent of a working c# assignment statement is not working?
bytes(i / 2) = Convert.ToByte(hex.Substring(i, 1), 16)
Here's the c# followed by the vb.net function.
private byte[] StringToByteArray(String hex)
{
int NumberChars = hex.Length;
byte[] bytes = new byte[NumberChars / 2];
[CODE]...
And the vb.net that is throwing the error within the for loop
Private Function StringToByteArray(ByVal hex As String) As Byte()
Dim NumberChars As Int16 = CShort(hex.Length)
[CODE]...
View 2 Replies
Aug 17, 2009
I want to Drag out an item from the program to the draged out Location ie. Desktop.
Mainly its a picture in a picture box that needs to be Draged and Droped from the program to the droped location on explorer
View 2 Replies
Jun 11, 2012
when I came across an error (The I/O operation has been aborted because of either a thread exit or an application request) regarding this code:
"Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
If closingdown = False Then
received = SerialPort1.ReadTo(vbCr & "R") 'Motion port receiving data. needs a vbCR & "R" is sensor out is an ASCII "R" followed by three characters(which is the distance measured)
End If"
It only occurred on "received = SerialPort1.ReadTo(vbCr & "R")".
However sometimes this error is not shown, but most of the time it does occur.
This error only occur when i want to close the form. Other than that it's perfectly alright.
View 6 Replies
Oct 14, 2010
I have a form called frmReport and on this form a user makes selections and clicks the "btnBuild" button which in turn creates a crystal report and displays it. However sometimes this process can take some time to build the report. So I placed a panel control along with a progress bar to let the user know that the system is working. However when the form runs the progressbar does not run until the last few seconds before the report is displayed. how to get the progressbar to "run" while the report is building ? (The progress bar is set to marquee.)
Private Sub btnBuild_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuild.Click
' Display panel control with progress bar
[Code]....
View 2 Replies
Apr 27, 2012
I want to know the behavior of string array when using For Each loop in it. Consider following code:
Dim StringArray(499) As String'fill in each element with random string
Dim count As Int32 Dim current As String For Each current in StringArray
[Code]...
As shown in the code above, if I need to access StringArray twice using For Each loop, is that true that ALL elements in StringArray will be loaded twice even though I only use 10 elements in each For Each loop? From performance point of view, is that advisable to use String array as data structure to store a list of strings that needed to be accessed multiple times, for example 20 times within a method?
View 1 Replies
Jun 16, 2010
I need to have the following : (name1 + "a") + (name2 + "a") + ...
Dim separator() As String = {"|"}
myString.Split(separator, StringSplitOptions.None).SomeLinq(...)
I don't know what to add at the end to add an "a" to each element...
View 2 Replies
Oct 28, 2010
I want to perform a bitwise-AND operation in VB.NET, taking a Short (16-bit) variable and ANDing it with '0000000011111111' (thereby retaining only the least-significant byte / 8 least-significant bits).
View 3 Replies
Jun 13, 2012
I have an array of a structure and I need to assign an element of this array to a variable of the same type. In vb6 I'd use something like the following pseudo-
View 3 Replies
May 18, 2012
I have some code that i cant work out why its happening and how to fix it. What im attempting to do is loop through the controls in a gridview and replace it with another control along with the text
Dim i As Integer
Dim row As GridViewRow
Dim rowCell As TableCellCollection = row.Cells
[Code].....
View 1 Replies
Aug 20, 2010
i have PDF forms creating .exe application using Crystal it is giving some times "Not enough memory for operation" error in production intermittently for below code. the error is not reproduced in TEST if i reset the same claim in next batch , it is creating PDF form without fail the server has enough memory the application is in .NET2003
rpt1.ExportToDisk(ExportFormatType.PortableDocFormat, sPdfFile)
View 3 Replies
Jun 25, 2011
I have installed vb.net 2010 express , but when I run It I get : "Error , the operation could not be completed".And I cannot do nothing with visual studio 2010.
View 1 Replies
Mar 12, 2012
How does the "Undo" operation work? Not looking for a specific code, I am just curious to how it works.
View 3 Replies
Sep 14, 2009
I am calling a dll function from my dowork event. When i click on cancel button, i want the background worker to stop executing thread. Im using VB 2008 Express edition.
View 1 Replies
May 26, 2011
I am using an httpWebRequest in my windows app to download files from a webserver (sURL), to a local folder (fileDestination) as such:
Public Function DownloadFile(ByVal sURL As String, _
ByVal fileDestination As String, _
ByVal WebRequestType As String) As Boolean
Dim URLReq As HttpWebRequest
Dim URLRes As HttpWebResponse
[Code] .....
This works fine for the first few files. But then it starts giving the error:
"operation has timed out"
on the URLReq.GetResponse line.
View 2 Replies
May 30, 2010
I'm working in a windows app. with vb.net it is working very fine with me but after I make it as a setup file and install it it shows an error.I will explane the problem hereunder:the App. is for importing the data from xsl.file(user select it from file dialog)and store it in DB access file. It works pretty good when it is running in VS .. but after installation it is not.The error msg: "Operation must use an updateable query.""When JIT debugging is enabled, any unhandled exception.will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box."
View 4 Replies
Apr 16, 2007
have a form onto which i've place a menu item called Exit. When I click the Exit, i expect it to close the entire application.Here is the code
Private Sub mnuExitApp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExitApp.Click
Application.Exit()
[code].....
View 2 Replies
Nov 20, 2011
I have an error when I try update values from one data table into another.I am using microsoft access 2007.For the datatable in question I can Insert data into it no problem, but I get the following error when trying to update -
Operation must use an updateable query.I dont think it can be a permissions problem or a file access problem because I can execute an insert sql query on the same file.
[Code]...
View 4 Replies
Dec 29, 2010
I have to code in VB.Net to delete first 16 columns from given input .csv file .[code\...
View 2 Replies
Nov 4, 2009
this is the code have written am unable to perfrom the log in operation.[code]
View 1 Replies
Feb 23, 2012
I've a problem using simple logarithm function Log in some ButtonClick Event. Log is underlined with next warning:System.Diagnostics.Log is not accessible in this context because it is Friend.
Have I missed something or this happens because of the Express version of Visual Basic?
View 1 Replies
Jun 22, 2011
I'd like to read from a file and if I fail, let the user retry or otherwise give up. So far the code looks like this:
Read_Again:
Try
my_stream.Read(buffer, 0, read_len)
[code].....
View 3 Replies
Feb 2, 2012
I am using a BackgroundWorker, an OleDBDataReader, a DataGridView to retrieve records asynchronously from an Access database. I call ProgressChanged event from the DoWork event every time I retrieve a record. In ProgressChanged event I add that record to the DataGridView and also update a label. There are about 2000 records to retrieve.I have two problems:Although I'm running an asynchronous operation, the UI remains unresponsive unless I use Thread.Sleep() inside the DoWork event (Why?). Using Sleep() method with an argument of 1 causes the process to run 20 times slower! (Process takes about 1 second if I comment out the 'Threading.Thread.Sleep(1)' line, compared to 20 seconds if I use it.) What can I do to get a responsive UI and a fast background operation (at least not 20 times slower!)?The other problem I am facing is: if I close the form while the asynchronous operation is ongoing, I get this exception (I think in the ProgressChanged event): Exception has been thrown by the target of an invocation. I tried using FormClosing event to end the process but no luck. How to fix this?
View 5 Replies