PlausiblyDamp
Administrators-
Posts
7016 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by PlausiblyDamp
-
The only thing I can imagine being the cause of the problem is VB's default form instances - I've never personally used them (with or without threading). If you amend your code so it isn't relying on the default instance then things should work fine - I've attached a simple re-hash of your code that does perform as expected. Public Class Form1 Delegate Sub MsgDlg(ByVal Msg As String) Dim T As New Thread2(Me) 'Pass ourselve in to the constructor Public Sub AddEvent(ByVal Msg As String) If InvokeRequired Then Dim MsgSub As New MsgDlg(AddressOf AddEvent) ListBox1.Invoke(MsgSub, Msg) Else ListBox1.Items.Insert(0, DateTime.Now.ToLocalTime.ToString & ": " & Msg) End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click T.Journey() End Sub End Class Public Class Thread2 Private _f As Form1 'store a copy of the form we are updating Public Sub New(ByVal f As Form1) _f = f End Sub Dim Locations() As String = {"a", "b", "c"} Public Sub Journey() Dim Elsewhere As New Threading.Thread(AddressOf Wander) Elsewhere.Start() End Sub Private Sub Wander() Dim Location As String For Each Location In Locations _f.AddEvent("Reached " & Location) 'use the stored form rather than the default instance Next End Sub End Class
-
Not sure where I read it but I think extension methods in C# 3 allow you to do this kind of thing i.e. public namespace Sample{ public static class SampleExtensions { public static int StringLength(this string aString) { if(this == null) return 0; else return aString.Length; } } } This could then be used like using Sample.SampleExtensions; void Method1() { string s = null; int i = s.StringLength(); } syntax might be off as I don't have any version of VS here, never mind a copy of Orcas installed ;)
-
IDE throwing an error when opening Form because of UserControl
PlausiblyDamp replied to joker77's topic in Windows Forms
Not got VS handly at the moment so I could be wrong, but I seem to remember that anything inheriting from System.ComponentModel.Component (which should include controls) will have a DesignMode property - just check the value of that before trying to load the XML file. -
Are you compiling your resources into a DLL or just attempting to load the .resx file at runtime?
-
That should be fine - just remember to make sure your policy dll correctly refers to 2.0 and not 1.0 and you should be fine.
-
It looks like the public key token used in the config file is different to the one used by the DLL - if they don't match then it won't work.
-
Under SQL a ROLLBACK statement rolls back all active transactions. In your example this would include updates performed by both sp1 and sp2.
-
Feel free to post up the files - I should have time to look at it this week anyway.
-
Signing both versions of the dll (and the publisher policy) with the same key tells .Net that these files are produced by the same company (or individual) and can be substitued for each other. If .Net didn't have a way to verify this then anyone could provide a Dll of the corrects name and substitute it for one of your - this would be a major security risk. The naming of the publisher policy is very important - get it wrong and it will not work. If the Original assembly was called TestAssembly.dll and was of version 1.0.0.0 the publisher policy dll would need to be named policy.1.0.TestAssembly.dll the 1.0 in the name means this applies to any TestAssembly dll with a major version number of 1 and a minor of 0 - note this is the version of the original assembly. Also the command line you are using to build the policy could be incorrect - it would need to be. al /out:policy.1.0.TestAssembly.dll /version:1.0.0.0 /keyfile: /linkresource:TestAssembly.config To deploy this you would need to install the DLL / config file into the GAC on the target machine.
-
Have you looked at This Thread on developing a plugin based system? The basic idea is an excellent way to implement your required functionality - the front end application will decide on the dll to load at runtime based on what it finds in the folder - as long as the interface is the same (as you said it is) then it won't care how that interface is implemented.
-
Just looked at the site you linked to and as an example of performance 'hello world' was probably not the best ;) For example Matrix Multiplication gives a cpu time of C# : 0.45 secs PHP : 53.27 secs http://dada.perl.it/shootout/index.html gives the full list of test if any one is interested in the full comparisons. One thing to bear in mind when comparing performance of a .Net application is the fact they are JIT (Just In Time) compiled - on the first execution of a given function you incur the overhead of compiling the MSIL code to native machine code. If a function is executed rarely (or only the once) this overhead can indeed far outweigh the benefits that compiled code gives... Unless your application is very cpu bound though other factors will often play a bigger role in the overall performance of your application - efficiency of it's provided libraries, memory management, IO performance etc. can all make big differences at runtime.
-
I suggested InvalidPathChars so as not to confuse anyone on .Net 1 - the warning will be enough to point any .Net 2 developers to the correct method. Rather than calling .IndexOf in a loop you could just call .IndexOfAny and pass in the array of characters returned be InvalidPathCharacters (or GetInvalidFileNameChars).
-
Split new posts to a New Thread as this was an old post.
-
System.IO.Path.InvalidPathChars is an array of invalid characters (good choice of name really) - you could always do an .IndexOf on these characters against a possible filename to check for the existence of invalid characters. Other than that checking the length against the maximum allowed length (255 characters IIRC) is probably all you would need to do.
-
It looks as though you are getting a second message pump for the dialog box - effectively the dialog is being modal on it's own windows message pump. Is there a reason you need the dialog to have it's own thread?
-
Could you attach the two files in question - it might be easier to see the problem that way.
-
If there doesn't appear to be any namespaces declared within the dll try removing the Imports TestApp.Tire and see if it compiles then.
-
If you load the compiled tire.dll into ildasm.exe what does it show the namespace / class name of the tire class to be?
-
Re: Text parsing If the document has been properly created then various characters should have been encoded i.e. < and > would be < and > so in that case it should still be ok. Unfortunately if the document does contain such symbols in an un-encoded form it will make parsing of the file very difficult indeed.
-
Are there any differences in operating systems (including service packs) between the PCs in question? Are they all running the same version of the framework? If you are accessing Dlls that aren't part of the framework are they all present (and the same versions)? If these other Dlls are from a 3rd party how were they installed on your development PC? Have you tried installing them on the client PC in the same manner?
-
Try Declare Auto Function SetWindowPos Lib "user32" (ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, _ ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, _ ByVal uFlags As UInteger) As Boolean as your declaration. Depending on exactly what you are trying to do via this call you might be able to do without the API anyway. Try the following and see if it suits your needs. Me.TopMost = True Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None Me.Location = New Point(0, 0) Me.Size = Screen.PrimaryScreen.Bounds.Size
-
You could call my rather badly named DoStuff routine from anywhere - as long as you provide a Graphics object for it to draw into. Where this graphics object comes from or what it is isn't the routines problem though. If TedN was just wanting to draw onto the form from any method / event handler in the form then using the form's .CreateGraphics method would provide a valid object to draw onto. Personally I would go with MrPaul's suggestion of doing all graphics rendering in the Paint event - this way it will be called when it needs to be redrawn (including external reasons like your app being covered and uncovered by another window).
-
Would something like this Public Sub Form1_Paint(ByVal sender As System.Object, ByVal e As PaintEventArgs) Handles MyBase.Paint DoStuff(e.Graphics) End Sub private Sub DoStuff(g as graphics) Dim sName As String = "TedN" Dim oBrush As New SolidBrush(Color.Black) Dim oFont As New Font("Tahoma", 32, FontStyle.Bold) Dim oStrFormat As New StringFormat(StringFormatFlags.DirectionVertical) g.DrawString(sName, oFont, oBrush, 0.0F, 0.0F, oStrFormat) end sub be suitable.
-
Does it matter which n1 would get updated? If you executed the update multiple times would it always be required to update the same one? Is there the possibility that on some occasions you would want to update a (some) value(s) other than the first one?
-
Try changing the Longs to Integers and seeing if that makes a difference.