Asp.net - Threading Settings After Converting Vb6 Code To .net?
May 25, 2012
We use a number of VB6 DLLs in classic ASP, using Server.CreateObject in the ASP page. The DLL code has recently (as a test) been converted to VB.Net 2008, and all the obvious issues that usually arise have been dealt with, meaning we are now able to use a .Net version of the DLL in classic ASP using interop (by using regasm to register the assembly for use in COM). The code that the converter added to the objects to make them usable in COM was <System.Runtime.InteropServices.ProgId("My.ObjectName")>, just before each class definition.
We have started noticing an inconsistent performance issue when using this new version of the DLL vs. the VB6 version in that it can sometimes take much longer to perform some tasks (even the task of constructing the objects from the DLL). In fact the same unit of work, including some DB work - now through interop ADO - can vary wildly (This is not limited to ADO work though!). We have started looking into this to try to figure out if it's some constant source of inefficiency, or if it's a load issue (threading related maybe).
I cannot seem to find a straight answer to the issue of threading when converting the code base. The DLL in VB6 is configured to use "Apartment Threading", the only other option being "Single Threading". Is this something that requires attention and is relevant when converting to .Net given we are still using the DLL through COM, and does anyone know what needs changing/configuring/checking?
View 1 Replies
ADVERTISEMENT
Apr 14, 2012
I want to have My.Settings.Delay in seconds not milliseconds adding the 000 for the user. I tried My.Settings.Delay + 0 + 0 + 0. but can't sort how to do this.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim var As Integer
Dim startVal As Integer
[code]....
View 4 Replies
Feb 8, 2010
I am trying to execute a line of code that i'll call f(x) and include a timeout. f(x) is an function in excel that can fail catastrophically. I did not code f(x) and the failure generates a dialog box. When 'ok' is clicked, Excel immediately closes. BTW: error trapping (On Error Resume Next) does not trap this error.
[Code]...
View 5 Replies
Oct 11, 2011
Wheres my error on this code...
Imports System.Net
Imports System.Threading
Public Class Form1
[CODE]...........
Basically what I want to do is that User will select how many thread w/c is the PickThread.value, then it will do the stuff.
View 11 Replies
Mar 30, 2011
I had recently(2 months before ) found some code for locking the screen. Here's the link to that code submission in our CodeBank : [URL]
I wish to get a clear idea of what it actually does. As it is a bit advanced code for me.
Here's the main part of the
CODE:
View 6 Replies
Apr 21, 2009
I am creating an IDE for a game script with similar functionality as the Visual Studio IDE (at least, some of it). The game script consist of code that looks visually a bit like C code. It uses braces to define the start and end of a 'class' and uses nested braces to define the start and end of an 'event' in a class.
What I want finally is to have two Comboboxes above the text editor, one that lists each Class and the other listing each Event. The comboboxes should also show the Class and Event that the caret is currently in, just like in Visual Studio.I have attached an example of such a script (you can open it with Notepad).However, here is a short example where you can also see how I "defined" classes and events:
class1
{
event1
{
[code]....
As you can see, the classes are the 'names' of each block of code, defined by matching braces { }. The events are the names of each nested block of code, also defined by matching braces { } but inside a class. There is only one level of nesting.As you can also see, the layout can follow the standard C-style layout, or a slightly different layout (using the opening brace on the same line as the class/event name), or even a completely chaotic mess. As long as the braces match correctly, the code is valid.So in short, the large blocks are classes, while the nested blocks are events.
What I want to do, is parse an entire script, and store all the Classes (and eventually, also all the Events, but let's forget about them for now). I want to store the Class name, start position (defined as the start index of the name), end position (defined as the index of the closing brace) and the full text (defined as the text between start and end position, so including the name).
vb.net
Public Class clsClass
Private _Name As String
[code]....
The code works basically by finding every first opening brace (the opening brace of each CLASS, not event), and then loops through the class (using a brace counter to keep track of the nested braces) until it found the last closing brace. It then stores the name, start, end and fulltext in a new clsClass and adds it to the list to return.
View 3 Replies
Apr 22, 2011
I am working on an app and I am a bit confused w/ threading. I understand the point of threading but I am not getting when to use a background worker thread vs. a standard thread vs. a thread pool. Can someone shed some light on when to use which? Right now, I am trying code an app that does stuff initially in a sequential order and then eventually must thread (otherwise it takes forever). The problem I am having w/ the sequential stuff (and threading later) is that I need a button to be able to stop execution of code. [Code]
I did the background worker on this first sequential operation because when I tried w/ out it, the text box didn't update at all until the web page contents were retrieved. Basically, the text box change of "Starting." doesn't show up until the web page is finished processing even though the assignment to the text box happens before that code.
View 11 Replies
Jul 29, 2009
Multi-Threading. I have got a simple bit of code that will need to be repeated but with a chance of it overlapping the only complex bit is there will be a varible that will be different each time. so I was wondering if I put it in another Thread and store the varible within the thread code would that achieve what I am looking for? To make it slightly easyier once the thread is started and pulled the Varible in there will be no cross talking between the thread and main app thread (ie no progress reports, no aborts/suspends etc) Nothing will be feeding back on thread completion either, when it ends it ends.
This is what I have so far:
Imports System.IO
Imports System.Threading
[CODE]...........................
View 5 Replies
Jun 8, 2009
I m comparing two images in VB.Net..I get the code in C# & dat code is working 100 % Correctly..Now want to convert dat code to vb.net..& i need help in just converting two lines-
[code]...
View 6 Replies
Mar 16, 2010
What do I want to achieve: I want to perform some time consuming operations from my MDI winforms application (C# - .NET). An MDI child form may create the thread with the operation, which may take long time (from 0.1 seconds, to even half hour) to complete. In the meantime I want the UI to respond to user actions, including manipulation of data in some other MDI child form. When the operation completes, the thread should notify the MDI child that the calculations are done,so that the MDI child can perform the post-processing.Should I use explicit threading (i.e., create explicit threads), thread pools? Or simply just propose your solution. Should I create foreground or background threads?And how does the thread communicates with the GUI, according the solution you propose?
View 7 Replies
Jul 20, 2010
The coding that I have a problem with might make people think that I am creating some malware. So the project I am doing is associated with iTunes. iTunes allows people to have one library. There is another way, but it is very confusing to some people, and very unreliable. So my project is that I will allow people to have multiple iTunes libraries on one computer. So the problem is this. In order to have an option to choose your library, I gotta make sure that iTunes is not running.
So this is the script:
Private Sub CheckAndCloseiTunes()
retry:
'Custom class that includes the function to safely close iTunes
Dim Processes As Process() = Process.GetProcessesByName("iTunes")
[CODE]...
So when I use the Threading.Thread.Sleep(2000) code, the form becomes unresponsive.
View 4 Replies
May 13, 2012
I need assistance converting the following C# code which works into VB code. The code detects when a specific type of USB device is connected and disconnected and writes the status to a status strip:
[code]...
View 1 Replies
Aug 3, 2010
I got this code from msdn[URL]..I have most of it converted but having an issue with the following sub getting it converted correctly Protected Overrides Sub AdjustEventHandlers(ByVal sender As
[Code]...
View 3 Replies
Jan 20, 2011
I am converting a c++ code to vb but there is a problem, i dont know how this code work, if you know what is type of SetFilter parameters and SetBitFilter tell me. i cant use SetBitFilter in vb because it give me an error this is cause of i dont declare them correctly or their values. but when i use SetFilter it work few second and it stop working and with a dialog that have 2 button (close and debug)
This is code in c++ :
CODE:
View 1 Replies
Feb 16, 2009
I found some code on the net that is supposed to convert a BMP file into a AVI file.
[URL]
The example is in C# so i converted it using a C# to VB.NET converter and fixed a few of the conversion bugs. The code executes but fails on the line 'Throw New AviException("error for AVIFileOpen")' saying 'AVI exception unhandled'.
View 5 Replies
Jun 30, 2009
I have some code, that I am converting from C# to VB, in the code is the following line.
int index = ((int)document.GetCharAt(wordOffset +1)) % 256
that translates to something like this:
Dim index as Integer = CInt(document.GetCharAt(wordOffset + 1)) Mod 256
The problem is that the GetCharAt() function returns a Char type (pretty obvious from the name). VB throws an error saying that Type Char can't be converted to Type Integer. So my question is, what is the result of the explicit conversion in C# code?
View 6 Replies
Feb 5, 2010
I am currently in the process of converting a program I have developed from VB6/VBA to Visual Basic.NET. The object of this function is to run a query on an SQL Server Hosted database and output the results to Excel. I have a couple of last final problems though, in the old vb6 lines:
[Code]...
View 4 Replies
Sep 24, 2010
I never used delegate before Currently I am converting some C# code to VB.NET and am having some issue, it says
Error 2 Method 'Private Sub OnNewMessage()' does not have the same signature as delegate 'Delegate Sub OnChangeEventHandler(sender As Object, e As System.Data.SqlClient.SqlNotificationEventArgs)'.
[code]...
View 1 Replies
Apr 14, 2009
I'm trying to convert the code below to C#?
Dim inFile As System.IO.FileStream
Dim binaryData() As Byte
Dim strFileName As String
[code]....
View 8 Replies
Apr 12, 2009
I was looking for a way to get a direct link from mediafire's file hosting service. By default, when a user visits a download link, he will be presented with a download page where he has to wait for the download to be processed and then a link will appear.This link will appear in the div id 'download_link'.[url]
View 1 Replies
Mar 28, 2012
I have created a custom ribbon for Excel 2010. This ribbon has a custom tab with various custom buttons. I have these buttons programmed to run an existing Macro in Excel. This is functioning just fine, but I would rather have the button run the code instead of activating the Macro. Basically, the Macro inserts a template worksheet after the active sheet.how to convert this simple VBA code to VB.Net?
Sub Insert_Sheet_AfterActiveSheet()
Sheets.Add After:=ActiveSheet, Type:="C:template sheet.xls"
End Sub
View 7 Replies
Aug 9, 2009
I have problems in converting the following code-snippet from C# to VB.Net:
if ((currentItem.Tag as FileSystemKind?) != FileSystemKind.File)
{
if (currentFileName == GOBACK)
[code]......
View 3 Replies
Aug 15, 2012
I'm converting some C# code to VB.Net, as it's a language I know better, I've got some code that I can't figure out...
Dim mybtn As New ImageButton()
mybtn.ImageUrl = _imgUrl
Select Case _buttonType
Case ButtonType.Backpage
[CODE]...........
This is giving 2 errors:
Me.btnBackpage_Click = Delegate 'System.Web.UI.WebControls.CommandEventHandler' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor.
And
mybtn.Command = 'Public Event Command(sender As Object, e As System.Web.UI.WebControls.CommandEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
View 1 Replies
Nov 18, 2009
Public Const COLUMN_MODEL_ORDER As String = MDL_ORDER.ColumnName
DataModel.Config.DefaultView is a System.Data.DataView
how can I convert it?:
Dim ModelOrder As Integer = 1
Dim DataModel As New ProfileDataModel(New DBConnection, Me.ProfileID)
If DataModel.Config.DefaultView.Count > 0 Then
[code]....
View 5 Replies
Jun 26, 2009
I have this snippet of VB.NET code that I want to convert to VBScript. It basically starts Microsoft Word, displays the Open dialog and mail merges the selected document.
Dim oMissing As Object = System.Reflection.Missing.Value
Dim oEndOfDoc As Object = "\endofdoc"
Dim oFalse As Object = False
'Start Word and create a new document.
Dim oWord As Word._Application
Dim oDoc As Word._Document
[Code]...
View 2 Replies
Mar 3, 2011
Visual Studio 2005.I was converting some of my source code to C#.However, when I was doing the code snippet below, I noticed I don't have the IsNumber method.Why is the IsNumber missing? I wanted to use it so that I can force a user to enter only numbers.
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar.IsNumber(e.KeyChar) = False Then
[code]....
View 4 Replies
Jan 28, 2012
i am trying to port one of my old vb6 applications to vb 2008 Having trouble coverting this
Call cNavAndWait.navigateAndWait(WebBrowser1, "http://www.mysite.com")
Set HTML = WebBrowser1.Document
For Each HyperLink In HTML.links
[code]....
The associated html code im trying to click looks like this...
<a onclick="document.location.href = '../blah.php' + document.location.search; return false;" href="../files/blah.jpg">Click Here!</a>
View 2 Replies
Sep 21, 2009
I was trying to figure out how to convert a string (that the user would input to the program via a textbox) into actual code for the program to compile. For example, if the user was to enter: (5*100)+(20-3). How could you take that inputted string, and have the program solve it and return the value?
View 3 Replies
Jan 2, 2012
i'm making a console program that consults a website of my work but it uses https and has a Untrusted certificate so i get this error: This Connection is Untrusted i did some research on the internet about this issue and come up with this code
//for testing purpose only, accept any dodgy certificate. public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
[Code]...
View 6 Replies
Mar 7, 2010
All the automated, online converters weren't able to convert this code. Unfortunately my brief knowledge of C# has also let me down. The code originates from a blog, linked from another of my questions.
[Code]...
View 1 Replies