PlausiblyDamp
Administrators-
Posts
7016 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by PlausiblyDamp
-
'something like dim d1,d2,d3 as date 'assume date vars have been assigned values if d2 > d1 AndAlso d2 < d3 then 'd2 is between d1 and d3 end if
-
You can still use the System.Configuration namespace under 2005 - the built in tools just make it easier to work with configs and settings. The problem with writing changes back to the applications directory is that on XP and higher the user won't have permissions by default - you will need to either relax security on the applications folder (on every single machine), or put the users in a group with sufficient permissions (probably not a good idea as this would mean giving them far more permissions than they need for this single application). What kind of information are you storing in the app.config file? Is this really something any user could / should modify and affect all other users of the same PC?
-
Not 100% on this but a Byte array is probably the easiest way to represent them.
-
I wasn't overly enthused with my own suggestion either, just couldn't think of an easier way. Did toy with the idea of overriding WndProc but that still looked like an awful lot of work to implement.
-
Not 100% on this but you would probably need to set it's DrawMode to one of the OwnerDraw options and handle the DrawItem event to take care of the actual rendering to screen logic.
-
http://support.microsoft.com/kb/286358 sounds like it could address your problem, should be worth a read.
-
Just declare the parameters type as the interface rather than object and it should work fine.
-
If Len(mailAttachment) <> 0 And System.IO.File.Exists(mailAttachment) = True Then Dim fileAttached As New System.Net.Mail.Attachment(mailAttachment) message.Attachments.Add(fileAttached) fileAttached.Dispose() End If If Len(mailAttachment2) <> 0 And System.IO.File.Exists(mailAttachment2) = True Then Dim fileAttached As New System.Net.Mail.Attachment(mailAttachment2) message.Attachments.Add(fileAttached) fileAttached.Dispose() End If 'Sends the message smtpClient.Send(message) 'being done AFTER a Dispose You are attaching the file, disposing of it then sending it - try sending then disposing to see if that fixes the problem.
-
Just a quick suggestion but have you tried sending the mail before disposing of the attachment?
-
If the base class implements the interface then the derived class will inherit it's implementation. If the base class is abstract (MustInherit in vb) then the derived class will be required to implement the interface. If the function has a parameter declared as either a base class or an interface then whatever you pass in must either inherit from the base class or implement the interface - is that what you meant or are you after something different?
-
You should be able to use something like [assembly:ReflectionPermission(SecurityAction.RequestMinimum, MemberAccess=true)] I haven't got VS handy on this PC so I might be slightly off with the syntax though.
-
Redistributing a SQL application
PlausiblyDamp replied to CryoEnix's topic in Database / XML / Reporting
Have you considered SQLExpress? -
ShowDialog will suspend execution of the Form1' Closing event until the second form is closed, have you tried just using F.Show() instead.
-
http://www.xtremedotnettalk.com/showthread.php?t=100425 has some possible solutions. Also http://www.microsoft.com/whdc/system/CEC/mm-timer.mspx discusses some of the different timers provided by windows.
-
The Process Class is the easiest way to run each program, it has a WaitForExit Method that you can used to prevent your application doing anything till the app has exited.
-
If you right click on the DataTable in the designer you have the option of adding additional queries into the table adapter, if you use a parametersied bit of SQL it will even generate a strongly typed function for calling the SQL.
-
Not really played with the UpdateProgress control much, could you not access the label through it's .Controls property instead though?
-
Have you looked at http://www.pinvoke.net - there are an awful lot of P/Invoke declarations there. Other than that the common conversions from VB6 are normally Longs become Integers or IntPtrs and Integers become Shorts. In fact if you are using VS 2005 it even gives you a menu entry under the Tools menu to convert VB6 code that might help in converting simple Declare statements. Other than that which parts of the post are relevant as there may be an easier or an alternate way that won't involve interop and P/Invoke.
-
Using New Keyword but still just a reference? (VB.NET)
PlausiblyDamp replied to Arokh's topic in General
I've commented your code a bit in an attempt to explain... Class ClassA Public VarA as String Public VarB as String End Class ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Creates a new instance of ClassA and assigns it to the SomeClass variable Dim SomeClass as New ClassA SomeClass.VarA = "A" SomeClass.VarB = "B" 'Creates a new instance of ClassA and assigns it to the SomeOtherClass variable Dim SomeOtherClass as New ClassA 'Assigns the SomeClass variable to the SomeOtherClass variable '- now both variables point to the original ClassA instance 'and neither points to the second instance which is now eligible for garbage collection SomeOtherClass = SomeClass 'As both variables point to the original class instance this effectively set's VarA for both SomeOtherClass.VarA = "B" Debug.Print(SomeClass.VarA) Then end result would be the same if you omitted the New keyword on the line Dim SomeOtherClass as New ClassA however the code with creates a new (but never used instance) while without you just declare a variable that can point to a valid instance. For the last question they are called Default Properties un der VB. -
Just as a simpler idea would something along the lines of Class VirtualArray2 Dim Structs As New List(Of FileStrc) Dim FileIndex As SortedDictionary(Of String, Int32) Dim Ed2kIndex As SortedDictionary(Of String, Int32) Public Sub Add(ByVal fileStructure As FileStrc) Dim index As Int32 = Structs.Count Structs.Insert(index, fileStructure) FileIndex.Add(fileStructure.FilePath.Path, index) Ed2kIndex.Add(fileStructure.Info.Hashes.ed2k, index) End Sub Public Function GetByEd2k(ByVal hash As String) As FileStrc Dim i As Int32 = Ed2kIndex(hash) Return Structs(i) End Function Public Function HashExists(ByVal hash As String) As Boolean Return Ed2kIndex.ContainsKey(hash) End Function Public Sub RemoveByHash(ByVal hash As String) Dim i As Int32 = Ed2kIndex(hash) Dim f As FileStrc = Structs(i) If Not f Is Nothing Then Structs.RemoveAt(i) Ed2kIndex.Remove(hash) FileIndex.Remove(f.FilePath.Path) End If End Sub End Class not be suitable? Haven't tested it but it should allow you to maintain 2 internal indexes based on either the hash or filepath - you would just need to expand the example a bit.
-
If you try using http://127.0.0.1/MyApp what happens? Can you ping localhost? If so what address is it resolving to? If you have a proxy server configured under IE try either turning it off or make sure the 'Bypass proxy for local addresses' option is turned on. Failing that add localhost and your machine name into the exceptions bit of the proxy configuration.
-
How large a collection of objects do you have? Does an unsorted list of keys actually perform too slow and you really need them to be sorted or are you attempting to prevent future slowdowns? It might be easier to maintain a single list of your FileStrc objects and have a couple of dictionaries that maintain the key / object value (or key / index values). This could potentially remove the need for you to do any sorting or similar. You could make this easier still by providing an Add method that accepts a FileStrc class plus a FilePath and Ed2K as additional parameters. You would also need to provide methods to retreive and remove based on either a FilePath or Ed2K which would need to remove entried from all the internal lists but that wouldn't be a large chore (not compared to your current method anyway).
-
http://www.telerik.com/products/aspnet/controls/editor/overview.aspx is well worth a look - no ActiveX and cross browser support. Online demo and free trial as well. Have used the sharepoint version of this control and had no problems at all.
-
Not had time to have a proper look at your code yet - will try to do so later today though.... List(Of Object) is a bit of a pointless construct in most cases as it pretty much does the same as ArrayList. In your case you might find some mileage in using generics to replace some of the code bits e.g. Dim Indeces As New ArrayList 'ALIndex Class Sorting Classes 'could become Dim Indeces As New List(Of ALIndex) 'this would remove a lot of the casting currently needed in the rest of the class. also the ALIndex class and it's comparer could benefit Public Class ALIndex Public Name As String 'Sorting Name Public Comparer As IComparer 'The way to sort Public Sequence As New List(Of Int32) 'Array with indexes in correct order End Class Public Class IndexHierarchy Implements IComparer(Of ALIndex) Public Function Compare1(ByVal x As VArrayList(Of T).ALIndex, ByVal y As VArrayList(Of T).ALIndex) As Integer Implements System.Collections.Generic.IComparer(Of VArrayList(Of T).ALIndex).Compare Return x.Name.CompareTo(y.Name) End Function End Class Out of interest - it looks like your arraylist derivative is maintaining an internal arraylist and a seperate set of indexes into this arraylist for each field you need to search / sort on. Is that correct?