Convert Delphi's System.Copy To .net?

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


ADVERTISEMENT

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

Convert A Delphi Application?

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

Convert Old Delphi Code To VB 2010

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

VS 2010 - USB Reader Device - Convert Delphi Code

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

.net - System.IO.File.Copy Doesn't Copy?

May 27, 2011

I have a weird behavior when trying to copy a file with System.IO.File.Copy. The file never gets copied. More than that, the call doesn't generate an exeption!

I am using VB.NET, Framework 3.5. I'm trying to copy in C:Temp and I do have the privileges. Or at least I used to...

View 2 Replies

Cannot Convert System.Xml.XmlNode To System.Xml.Linq.XElement

Nov 24, 2010

I´m gettin the error Calling the fuction GetListItems but is kind weird because it works in Visual Studio 2008 Express but no in Visual Basic 2010 Express:

Dim ndQuery As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "")
Dim ndViewFields As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "")
Dim ndQueryOptions As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element,

[Code].....

View 1 Replies

Convert A System.Object To A System.Collections.Arraylist?

Oct 13, 2010

I am using Visual Studio 2005 and am writing a SSIS package. In the package I have a VB.Script that looks at a directory on a server and creates a list of the files. I then have a store Proc that looks at a table and gets a list of files that matches the files in the first array. The result is a fullresultset. The next step I need to create a 3rd array that only contains the rows from the first that are not in the second. However, I am getting the following error. Error: The script threw an exception: Unable to cast object of type 'System.Object' to type 'System.Collections.ArrayList'.

View 3 Replies

Convert An Object Form System.Drawing.Graphics To System.Drawing.Image?

May 23, 2009

Is it possible to convert an object form System.Drawing.Graphics to System.Drawing.Image?

View 4 Replies

Convert An Object System.Data.Linq.DataQuery To System.Linq.IQueryable?

Oct 21, 2009

How can I convert an object of type System.Data.Linq.DataQuery to System.Linq.IQueryable?I'm working with Visual Basic/Silverlight, and the source code of my query is as follows:

Public Function Get_Cli_Pag() As IQueryable(Of V_Cliente_Pagare)
Dim Qry = From P In Me.Context.Pagares Join C In Me.Context.Codigos On C.Codigo

[code]....

View 1 Replies

Value Of Type 'System.Func(Of String, String)' Cannot Be Converted To 'System.Convert

Feb 17, 2011

Value of type 'System.Func(Of String, String)' cannot be converted to 'System.Converter(Of String, String)

Why? They are both effectively a function pointer (or delegate?) to a function that accept a string and return a string.

View 6 Replies

How To Tell System Copy Source To Destination If Possible

Mar 30, 2011

I'm trying to copy a file, using System.Copy. The destination, if it exists, should be overwritten. I had been using a single line of code for about a month, without problems : IO.File.Copy(SourceFile, DestFile, True)But problems started about a week ago, when I started more advanced checks. Partially locked files fail to copy, and the destination gets deleted. Locked files, on the other hand, work correctly: they just trigger a file in use exception.So I added this line before launching the copy:Using TestForAccess As New IO.FileStream(SourceFile, IO.FileMode.Open, IO. FileAccess. Read, IO.FileShare.None) : End Using..This was supposed to launch an error if the file was in use. But it is to sensitive. Some files (such as thunderbird's abook.mab) trigger an error in this added code, whereas they copied fine before (and you can copy them in explorer).My question basically is: How do I tell the system: copy source to destination if possible; if not, don't break destination?

View 3 Replies

Using Delphi 7 To Try To Use A .DLL

Jan 25, 2010

I am using Delphi 7 to try to use a .DLL created by VB.net. When I run TDUMP.EXE on the .DLL, it reports no exported data available. The VB.Net .DLL uses "RaiseEvent" to return data.[code]

View 1 Replies

Copy All Files From One Folder To Another In .net2005 Using System.io?

Feb 24, 2007

i am working in asp.net/vb.net I have to copy all files from a folder to another folder through coding using system.io the files should be copied in the new folder with their existing names

View 2 Replies

Correct Path For System.IO.File.Copy?

Sep 10, 2011

i got to do a program in VB.NET that copies a file from a pc to a usb device. I use the method System.IO.File.Copy(FileToCopy, NewCopy) in which i have to specify the destination path. The problem is that when i change pc the destination can change: for example in my pc i read my USB pendrive o G: and on my friend pc i read the usb pendrive on E:. How can i solve that? May i specify a general path to my USB giving it a name or anything similar?

View 5 Replies

Get The System Time Using .net And Copy It Into Clipboard Automatically?

Feb 19, 2010

How do I get the system time using vb.net and copy it into clipboard automatically?Is there a built-in function in vb.net for this?

View 2 Replies

VS 2008 Copy Resource To File System?

Jun 5, 2010

I'm writing a program that I want to attach another program (.exe) to. I tried adding it as a resource, but I can't seem to get the resource to export out to wherever the program is running.

View 3 Replies

C# :: Delphi To .NET Converter?

Sep 4, 2010

.NET converter (either C# or VB.NET)? I've inherited a bunch of Delphi code, never seen Pascal before and rather than learn it, I'd rather just try to use an automated converter, if available, and clean up the code after that. Can't seem to find this kind of tool anyway I search

View 3 Replies

File.Copy Many Times Results In System Crash

Jul 18, 2008

.NET masters!Im working on a VB.net file management program that copies 100,000s of small images (20 - 300 KB).At least it tries to. When doing large multi-hour operations I start getting exceptions with the"Insufficient system resources exist to complete the requested service." error message.In a few cases the computer has then crashed.After a lot of debugging, finally with livekd kernal dump I can see that the System PTEs in the Kernel Mem are getting very low.I can monitor the PTE's in realtime with Performance Monitor with the Memory/Free System Page Table Entries.After an hour or so the PTE's start dropping in what appears to be linear fashion as the program keeps copying.Im sure it is the copy function causing the problem, as when i let the code run but with the copy routine commented out, the free PTEs stopped going down.Behaviour is identical with both of these calls. System. IO. File.Copy(strFileSource, strFileDest, bOverwriteFile) My.Computer. FileSystem. CopyFile (strFileSource, strFileDest, bOverwriteFile)If I stop & close the program, PTEs do not seem to rebound at all. If I start the program again, the PTEs again start going down.SO: What is up with File.Copy? Why is it using and not releasing all these PTE's? Seems this memory should be free after the copy.How can I change my code to avoid running up the PTEs?The test computer is Windows XP sp2 with 500MB ram. (also been testing with 1.5 G ram)Ive found some helpful documents on PTEs, which discuss system configuration via registry settings. But this is not really an option for me as this is a commercial product that others will be using on their own computers.Detection, Analysis, and Corrective Actions for Low Page Table [code]

View 7 Replies

System.IO.File.Copy - Move A Lot Of Pictures From FOLDER A To Another

Sep 27, 2010

I'm trying to move a lot of pictures from FOLDER A to another, FOLDER B. However, some of the pictures already exists in the FOLDER B. This stops my program saying it cannot copy the pictures over because they already exist. I'm trying to make it so any pictures from FOLDER A will copy over the pictures in FOLDER B if they are similar in name. Like... Folder A's pictures will just replaced the Folder B pictures if they have the same name. I was told to use the System.IO.File.Copy tool. Here is my code.

[Code]...

View 5 Replies

Convert System.Drawing.Graphics To System.Drawing.Image

Jan 20, 2010

I have a System.Drawing.Graphics g, which draw something in a PictureBox. Now I want to export this pGraphics to a new System.DrawingImage pImage (or Bitmap). But how?

Dim pImage As Bitmap
Dim g As Graphics
g = Graphics.FromImage(b)

[Code].....

View 9 Replies

Convert System.Drawing.Graphics To System.Drawing.Image?

Mar 10, 2010

I have two graphics I'm trying to superimpose into one, then display in a DataGridViewImage cell...The Value property of a DataGridViewImage is an Image type.

Dim Image1 As System.Drawing.Image = imgl_Imagelist1.Images(0)
Dim Image2 As New Bitmap(imgl_ImageList2.Images(0))
Dim DualGraphic As Graphics = Graphics.FromImage(Image1)

[code].....

View 3 Replies

Calling A Function From A Delphi DLL In .NET?

Sep 27, 2011

I've designed a Windows Service in Visual Basic 2005 that needs to call some functions from a DLL written in Delphi 5. If I try to add this DLL as a reference, I get this error:

"A reference to 'C:ProjectsServiceProMDPUpdateServiceMessageStubApplicationSPHost.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."

I assume that it is just not possible to add this DLL as a reference to my VB2005 project, since the DLL was written in an old version of Delphi, correct? This isn't a big deal, as I can just use the DllImport function from System.Runtime.InteropServices, but if it is possible, adding it as a reference would be preferred.

My other question is, how would you be able to call a function from the DLL using DllImport, if the function you are trying to call takes a Delphi record data type as a parameter (if this is possible)? If possible, would I need to pass each field in the record separately or would I be able to define a structure in my VB app that mirrors the record definition in the Delphi DLL and pass that? Or, would it be best if I just created another function in the Delphi DLL that took various string/integer/boolean/etc. parameters that I could call from VB that would then call the original function in Delphi? I tried searching the internet for this specific question, but I couldn't find anything that looked useful.

[Code]...

View 1 Replies

Calling Delphi DLL With 'Type'

Jun 10, 2010

I've gotten a DLL from a supplier. Most functions I can call just fine, but some crash (System.ExecutionEngineException, doesn't even do with a try-catch...). The thing is that the ones that work are called with simply types, and the ones that crash have a type/class/structure in it.The documentation states how to call with "Visual Basic" without stating version. Here's how it looks..[code]I did figure out to use "Integer" in stead of "Long" and the strings needed some work but are fine now.Now... The "Type" doesn't exist in VB.NET so what should I do. Tried a class but that didn't work.I can call the DLL with "bad" data and get a good reply, eg "this and that is wrong with the input", but when I set that straight it crashes. I suspect that it's when it starts to write in the memory allocated by me and that does not match what the DLL expect.

BTW when I look at the class I made, I can see that - at least VS - lists the members in an alfabetical order. Is that how it's arranged in memory and could that be the problem if the order is different from the one expected by the DLL. I would epect that the total size was the same irrespective of order, so the problem would arise when I try to read the data and I would get junk.

View 2 Replies

Converting .Net To Delphi (API Stuff)?

May 8, 2011

Dim ThisModule As IntPtr
Dim Proc As Process() = Process.GetProcessesByName("Sol")
For i = 0 To Proc(0).Modules.Count - 1

[code]....

I have made this code, and works perfectly, but now... i want to make it in Delphi, the problem is... i have not the enough knowledge for make it, and... in google, i haven't found the information i need.

View 2 Replies

Delphi String Marshaling In .NET?

Jan 24, 2012

I've got some functions I need to call that are in some DLL files that have been written in Delphi 5 in a VB.NET 2005 application. I'm able to use the DllImport function to access the functions just fine; however, I'm having an issue with the Delphi string data type and passing it to and from the .NET application.

[Code]...

It takes two string parameters and one double. I can call this function from VB.NET just fine, but it will error as soon as it tries to use one of the string variables (so in this case, when it passes them to another function) and I've found that the string values in Delphi are junk when they've been passed to .NET. I'm guessing that the string objects behave and/or are encoded differently between .NET & Delphi 5, and that I have to apply some sort of Marshaling to the function parameters in .NET, but I've tried all of the different types of marshaling and nothing has worked. Unfortunately, I haven't been able to find anything about this issue on the internet.

Does anyone know how I can call this Delphi function from .NET and have it pass the string values in a manner so that they won't be corrupted when stored in Delphi?

View 2 Replies

Transfer Interfaces From Delphi Dll?

Apr 22, 2011

I have a Delphi written DLL that exposes some interfaces to a vb.net application.
The interfaces inherit from IUnknown (but this could be changed if required), simplified example:

IWindow = interface(IUnknown)
['{E9A11D0B-8A05-4CBA-83FA-C5CC6818DF6E}']
function GetCaption(var Caption: PChar): HRESULT; stdcall;
end;

[Code]....

Now I want to transfer a collection of IWindow to vb.net, and in the vb.net application I want to be able to loop through it with a for in loop.

I read that it's possible using IEnumerable/IEnumerator but I don't quite understand how to implement them. Are there any good tutorials about this, specifically showing the declarations on both side? Example code would be great.

Please note that I prefer not create a com dll that should be registered and imported. Currently I export a function that enabled me to obtain an interface.

View 1 Replies

Communicating Via RS232 - Dll / Delphi Win32 Exe?

Sep 23, 2011

I have a Delphi program that communicates with a vb.net dll that I created. The vb.net dll communicates with a Fluke scope meter via an RS232 connection. I have created a program that communicates correctly via RS232, giving me the anticipated value. Though, when I package this up as a dll and access the dll from my Delphi program I always receive a value of "1", rather than the value I was expecting (most cases a value in and around 240).I know that my delphi program is definitely communicating correctly with the dll and that my dll is definitely communicating with the scope meter

Here is my vb.net code:
Public Interface IFlukeComm
Function GetReading(ByVal Command As String, ByVal PortNum As Integer) As String

[code].....

View 1 Replies

Delphi To VB: Define Data Types?

Aug 11, 2011

in Delphi I have:

type osVer = (
osVerUnknown,
osVerWin95,

[code]....

I need to translate to VB...

View 3 Replies

Equivalent Of Delphi's Application.processmessages

May 31, 2009

In Delphi when we needed to allow the system to finish painting an object or something like that we could add a processmessages that would then let the system finish what it was doing before going on with the code.This was always handy when we wanted to show a message like "Please wait"before the start of a lengthy process.So then. What is the equivalent way of doing this in VB.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved