Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. With a question as vague and open ended what kind of answer did you expect? Tutorial in what way? Dll to do what? What language?
  2. You could create a class that contains properties for the price and item name and override the ToString Method to generate the correct output. the following quick (and 100% non-tested code) should give you an idea. public class MyItem public ItemName as string 'Should really be a property public ItemPrice as decimal 'Should really be a property Public Overrides Sub ToString() as string return ItemName & " " & ItemPrice.ToString() End Sub End Class
  3. Do you have a proxy server configured in Internet Explorer - if so turn it off and try again. Can you browse to the other computers IP address in IE?
  4. Overrides and shadows are a bit more complex than Squirm suggested. Overrides and Overridable allow you to write code which works with a base class but will call the sub classes overridden method. Paste the following snippet into a new form project Public Class BaseClass Public Sub ShadowNoise() MessageBox.Show("Class1") End Sub Public Overridable Sub OverrideNoise() MessageBox.Show("Class1") End Sub End Class Public Class SubClass Inherits BaseClass Public Overrides Sub OverrideNoise() MessageBox.Show("Class2") End Sub Public Shadows Sub ShadowNoise() MessageBox.Show("Class2") End Sub End Class and in the form paste this in a button handler. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim c As BaseClass = New SubClass() c.ShadowNoise() 'Notice the method called c.OverrideNoise() 'notice different method called End Sub if you put a breakpoint on this routine and step through the code notice which version of the functions get called when an override or a shadowed function is used.
  5. There is a migration wizard which will convert a VB6 project to VB.Net project, however I would strongly recomend against it. It will probably be better in the end to simply recreate the form in VB.Net as this will allow you to take advantage of newer form features like anchoring and docking controls, extra properties and also use the newer controls that ship with .Net.
  6. Rarely use Me at all - except like Divil just to get the intellisense, tend to use this all the time in C# though. Go figure.
  7. So, so close - took me ages to hit on the correct way in MSDN Private Function computeMD5(ByVal plainText As String) As String Dim ue As New UnicodeEncoding Dim bytes() As Byte = ue.GetBytes(plainText) Dim md5 As New Security.Cryptography.MD5CryptoServiceProvider Dim hashBytes As Byte() hashBytes = md5.ComputeHash(bytes) ' Convert result into a base64-encoded string. Dim hashString As String hashString = BitConverter.ToString(hashBytes ).ToLower().Replace("-", "") 'This line will do the trick ' Return the result Return hashString End Function
  8. You could speed that up by checking if it is divisible by 2 and then only checking the odd numbers. Also you could issue an Exit For if the number is prime and avoid testing all the numbers after the match has been found.
  9. Dim dateTemp As Date 'subtract days from selected date until the date is saturday Do Until dateTemp.DayOfWeek = DayOfWeek.Saturday dateTemp.Subtract(TimeSpan.FromDays(1)) Loop txtBeginningDate.Text = dateTemp.ToLongDateString() 'find the last day of the week txtEndingDate.Text = dateTemp.AddDays(6).ToLongDateString() or you could change the loop to Do Until dateTemp.DayOfWeek = Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat.FirstDayOfWeek dateTemp.Subtract(TimeSpan.FromDays(1)) Loop instead of hard coding the first day of the week.
  10. How large an array are you looking at? It may be an alternative to copy the valid elements to a new array. Alternatively could you not filter out the duplicates as you are adding them to prevent the duplicates in the first place. also having a look under System.Collections may save some time as there is a SortedArray class that puts things into a sorted order and allows binary searches so finding duplicates would be quick. Or even just using System.Array.Sort could save you having to do your own sort routine.
  11. If they are behind a router it may be the only way - there is a good chance they will have to configure the port forwarding anyway. If you look at a lot of peer to peer software this kind of configuration is required - or the app runs in a reduced functionality mode.
  12. Drag the progress bar from the tool box onto the splash screen. Set the timer to fire every second and update the progress bar in the timer event. After the timer event has fired 8 times close the splash screen.
  13. It may be easier to set up port forwarding on the router and just get the user to enter their router's address as part of the configuration.
  14. Could you not just write a join statement against the database and capture it's results in a DataTable? SELECT Table1.ID, Name,LastName FROM Table1 JOIN Table2 on Table1.ID = Table2.ID or alternatively have 2 DataTables in a DataSet and create a DataRelation to join them. You can then navigate the relation in code to find all matching records. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndive/html/data07122001.asp
  15. Could you not just include the meta tags in the aspx page, or is there something special you want to do with them?
  16. have a look at the System.Net.WebProxy class - this will allow you to select a proxy and provide credentials for it as well.
  17. http://www.xtremedotnettalk.com/showthread.php?s=&threadid=78815&highlight=boolean+bits
  18. Do you mean it is slow to retreive data or slow on making the initial connection to the database? If the former a well written and designed SQL solution should improve speed. If the latter then the problem could be due to other factors - network speed, name resolution, size (and fragmentation) of the access DB.
  19. the for ... next loop will keep looping till all items in the array have been checked - you will need to either count backwards through the items or exit the loop when a match is found For i = 0 To upperbound - 1 If target(i) Mod 7 = 0 Then found = target(i) maxindx = i Exit For 'This should exit the loop after a match End If Next i
  20. rough and ready but will show you how - works with northwind but should be easy to adapt to any database. Dim conn As New SqlClient.SqlConnection("Data Source=(local);Initial Catalog=Northwind;Integrated Security=true") conn.open() Dim cmd As New SqlClient.SqlCommand() cmd.CommandText = "SELECT MAX(EmployeeID) From Employees" cmd.CommandType = CommandType.Text cmd.Connection = conn Dim i As Integer = DirectCast(cmd.ExecuteScalar(), Integer)
  21. Ahhh, you mean the external IP address of the router / NAT / Proxy you are going through to get to the internet. .Net really only gives you the ability to get the addresses of the device it is installed on. Is there a particular reason you need this as there may be an alternate workaround.
  22. How are you creating the list view?
  23. What is the error it gives? Everything else in the form works okay though? Also you are doing this in a windows form project aren't you?
  24. You also want the checkbox to uncheck if the textbox changes? correct?
  25. Any chance you could post some code?
×
×
  • Create New...