Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. When you create your setup package - did you use the wizard or do it manually? Does the setup package deploy the required dependencies to the target pc? Just out of interest what other dependencies does it have apart from the .Net framework?
  2. Most of these controls already exist in .Net and can be found on the standard .Net toolbox. The wizard just doesn't convert the code to use the new controls. With some you could simply delete the old control and replace it with the new control - just rename it to have th old controls name. Other controls do behave differently though. The common dialog functionality and the progress bar could be replaced with .Net equivalents. Not sure about the skinner or the SregoCETPx1 control though (what do they do?). Also the code to access the registry could be converted to use the Microsoft.Win32.Registry class instead, sleep could now use system.Threading.Thread.CurrentThread.Sleep instead. If you are running VisualStudio 2003 you get a folder browser control so you could remove all the interop stuff as well. Not looked much further but what are you using CoTaskMemFree, lstrcat and SendMessage for?
  3. What are the exceptions you are getting?
  4. You may find some of the problems are down to the form having been migrated via the wizard. If you check in the converted code it is still using a lot of VB6 / COM controls and API calls which could be removed or changed to the .Net equivalents. In fact the overallprogressbar control is still the VB6 ActiveX control rather than the .Net equivalent.
  5. In the receiveFile function shouldn't you be opening the decStream as CryptoStreamMode.Read ?
  6. In "<"c , the c simple tells the compiler to treat "<" as a character rather than a string. If you are using a variable then it isn't needed.
  7. IIRC it's a bitshift operator. << shifts the bits to the left and >> does to the right.
  8. Have you selected a node in the treeview ?
  9. What is actually happening when you run it?
  10. You code should work then - what results are you getting? Also like I said above why are you defining collectionOb as Object rather than as a collection?
  11. Just reread your post and I think I jet what you mean now. in the snippet Case 1 collectionOb = keyCol Case 2 collectionOb = accCol Case 3 collectionOb = denyCol where are keyCol, accCol and denyCol defined? Also is there a reason you are defining collectionOb as an object rather than a collection?
  12. And I want a Porsche. However a bit more information would help out. Prevent them being opened where? In IE, Netscape, your own program? Would using a proxy server or similar device not work in this case rather than requiring code to be written?
  13. you have declared oControl as Control - not every control has a checked property. You will need to cast the oControl to a variable of type CheckBox before you can access the checked property. dim chk as CheckBox For Each oControl In Me.grpIndexSet.Controls If TypeOf oControl Is CheckBox And oControl.Name = tn.Text Then chk=DirectCast(oControl, CheckBox) oform.chkRequired.Checked = chk.Checked End If Next or similar.
  14. Are you calling the code from the page_load or from a some other event? Also I never suggested you were merely querying why you were returning yes and no as strings.
  15. Where are you calling this function from? Also why are you returning a string to indicate a True / False condition? Wouldn't a boolean make more sense?
  16. As Mehyar suggested - if you want it in a DataSet why not just create the DataSet and populate it with a DataAdapater? (Which uses the DataReader in a loop to do it's job anyway ;) )
  17. The other problem with CType is it is VB.Net only - if you need to port your code to another .Net language then you would have to use the .Net methods anyway. Even though the .Parse methods only take a string rather than an object the CInt etc. will still require some conversion behind the scenes , it's just that the 'guess work' on how the conversion is performed is hidden from us. You could use the .Net Convert class though to acheive this result. dim i as integer Dim sin As Single = 100.45 i = Convert.ToInt32(sin) By using the .Parse methods at least we can provide hints through .the overloaded versions in regard to formatting the string may contain (thousands separator, currency symbol etc.) giving us some control over the process. Finally you are correct about DirectCast requiring reference types, should really have tested my sample code ;)
  18. Ctype and DirectCast are slightly different in how they operate. Ctype is a generic conversion function and can replace the VB6 CInt, CDbl etc. However under .Net you are better off using the newer methods : CInt can be replaced with Integer.Parse(), CDbl with Double.Parse, CStr with .ToString() etc. DirectCast will not convert a variable of one datatype to another datatype, only allow you to assign the variable to a DataType that is the same type (or interface, or in the same inheritance hierarchy). i.e. In a button click event the first parameter passed in is declared as object - but would really contain the button control that was clicked. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim b As Button b = DirectCast(sender, Button) would assign the button to the variable b, we could then use b and it's methods / properties in a type safe way. This would work because the variable sender is really a button. However Dim i As Integer = 45 Dim s As String s = DirectCast(i, String) 'would not work s= CType(i, String) 'would work s=i.ToString() 'would work and is the .Net way in this case i is not a string DirectCast wouldn't work.
  19. Where are you defining collectionOb? What collection are you using with this routine?
  20. It shows you how to do a setup routine for your .Exe that will also deploy the framework if its needed - wasn't that what you wanted?
  21. You are calling the CheckUser sub which is checking if the user already exists or not but then calling the InsertData sub anyway - even if the user already exists. You may want to change the CheckUser to a function that returns a boolean Function CheckUser() as boolean 'Your code here 'change the end to if intID <> 0 then lblMessage.Text = "Choose another UserName" return True else lblMessage.Text = "Hello" return False end if and in the calling routine do sub StartMe(obj As Object, e As EventArgs) if CheckUser() = false then InsertData() end if end sub
  22. Creating an editor can be quite a difficult task. http://www.icsharpcode.net have one as part of their open source IDE (however it is released under the GPL / LGPL so you cannot just lift their code, although you could license it from them, and they do take that very seriously.) however the text editor portion alone runs to approx 200K of source code. If you search around these forums you will probably find several examples of how syntax highlighting etc can be implemented with the RichTextBox control. If you insist on writing an editor from scratch the book writen by the sharpDevelop team (http://www.icsharpcode.net/OpenSource/SD/Default.aspx) does go into some of the trade offs of data structures used in the editor, or have a look at some of the following links (useful but can get a bit dry in places) http://portal.acm.org/citation.cfm?id=4284.4288&dl=portal&dl=ACM http://www.finseth.com/craft/index.html http://www.cs.unm.edu/~crowley/papers/sds/node1.html
  23. If you want exact numerics use the Decimal data type. Double and Single are both floating point numbers and as such are prone to rounding errors.
  24. The second argument (e) contains this information. e.X is the X co-ord e.Y is the Y co-ord.
  25. Easiest way is give the class a Sub New that accepts the form as a parameter. public class Test private frm as Form1 sub new (f as Form1) frm = f end sub public sub Something () 'You could now refer to the form via the variable frm frm.Text = "Hello" end sub from within form1 you could then do dim c as new class1(me) c.something() Is there any reason you need to control the textboxes from a class? Could the code not be part of the form? Could the class not simply return data from it's functions that methods in the form use to update the textboxes?
×
×
  • Create New...