Jump to content
Xtreme .Net Talk

Bucky

*Experts*
  • Posts

    803
  • Joined

  • Last visited

Everything posted by Bucky

  1. An attribute is just like any other class, and in this way you could create some fields in the class that contain all the attributes you want to stick together, and just create a special constructor(s) that allows you initailize all them properly. Then, to query all these attributes with reflection, you could just cast the attribute into a variable and access its fields (the other attributes). Does that make sense? Am I completely missing the point of what you're trying to do?
  2. If Microsoft did everything correctly, ALL arrays, collections, hash tables, string characters, etc. should have a base index of 0 (except, of course for the archaic Collection class). This is the way all other programming languages do it, so it's only natural that VB.NET would follow suit. Goodness knows why VB6 wasn't that way.
  3. How about the String class's Replace function? Unlike of all the finding code that you have above, a Find-Replace situation just requires one call to the Replace method (in its simplest form; you may want to write more code for wildcard matching and case insensitivity): txtEdit.Text = txtEdit.Text.Replace(m_strSearch, "replace text here")
  4. Maybe the icon has a format that's not being shown on the form, but it is in the Icon property. Go into the icon editor and check that all different formats (different combinations of sizes and colors) are complete, and delete any unused ones. If that does not help... your guess is as good as mine.
  5. In the form designer, make sure the form is the selected control, and click the little ellipsis (the "...") next to the Icon property, and browse for your icon.
  6. Tryster's correct, the = operator is being used two different ways. The first way, it's used as an assignment operator, assigning the value of an expression to the variable. The seond time it's a comparison operator, comparing the value of result (which is False by default) to False, and because they are equal it returns True. Maybe this is clearer: result = (result = False) It's much easier to see a C-style language, beause its equality comparison operator is == result = result == false;
  7. Orbity, do you mean that 3D accelerated games just won't run on that monitor, or do you mean that they run but they're unplayble because it's too blurred?
  8. One solution I can think of would be read each XML file into its own DataSet, then add each individual DataSet's tables to a "main" DataSet, then report that main DataSet. This will only work (I think) if the tables all have different names.
  9. One way to go about this would be with XPath expressions, which XmlDocument objects can execute quite nicely.
  10. Well, the closest thing I can find is to [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/em_linescroll.htm]send the EM_LINESCROLL[/mshelp] message to the textbox using SendMessage, passing the number of lines in the textbox as the lParam (wParam is 0). That way it will scroll to the bottom no matter what line the caret is on (since the # of lines to scroll is based on what line the caret is on, but if the number is higher than the actual number of lines in the box, it will scroll to the bottom). In this example, rtb is the RichTextBox control's name. Make sure you define the API declare and the constant. SendMessage(rtb.Handle.ToInt32(), EM_LINESCROLL, 0, rtb.Lines.Length)
  11. If you Dispose() of the form, then its resources are freed and you can't open it again without reinitailizing the variable. Close() is the best way to close the form.
  12. The method I've used relies on the column index. I created constants representing each column... Private Const DG_COL_CHECK As Integer = 0 Private Const DG_COL_EDIT As Integer = 1 Private Const DG_COL_DELETE As Integer = 2 Private Const DG_COL_CLASS As Integer = 3 Private Const DG_COL_ASSIGN As Integer = 4 Private Const DG_COL_DUE As Integer = 5 ... and then, in the ItemDataBound event, you can get the button in the column (here it's the delete button for me)... Dim btn As Button = DirectCast(e.Item.Cells(DG_COL_DELETE).Controls(0), Button) ... and then set the button's onClick attribute: btn.Attributes("onclick") = "javascript:return confirm('Are you sure you want to delete the assignment?')" [edit]Of course, when you put the onClick attribute in, "javascript:" will be one word; it looks like vBilletin parses out javascript so that people don't put scripts in posts[/edit]
  13. In your main form that you're using to call the other forms, before showing the forms add an event handler to handle their Closed events: Public Sub FormClosed(sender as Object, e as EventArgs) ' Write to the file here End Sub ' this goes where you want to show the form, represented by the variable frm AddHandler frm.Closed, AddressOf FormClosed frm.Show() Or in C#: public void FormClosed(Object sender, EventArgs e) { // Write to file here } // this goes whereyou want to show the form, represented by the variable frm frm.Closed += new EventHandler(FormClosed); frm.Show();
  14. Well it doesn't look like the Attribute class has any protected members or methods that would return that information. The only two ways I can think of would be to 1.) pass the Type that the attribute is being applied to in its constructor(s) (which is lame, I admit), or 2.) if the Type class has some sort of method that returns what it's been applied to, use this.GetType() and figure it out from there. I don't know if such a method exists, but if it does I'd think it'd be in the Type class or somewhere in the Reflection namespace.
  15. Bucky

    sender ?

    Er, no it wouldn't... the sender argument is of the Object type, and the Object does not have a Text property. The compiler would not know how to cast it correctly, so it'd throw an error at you.
  16. http://www.xtremedotnettalk.com/showthread.php?s=&threadid=49500
  17. There is one line of useless code I noticed here. The ToString method, which every object has, is a function that merely returns a string representing that object; it does nothing to actually convert the object to a String type, nor does it do anything if you don't set it to a value. I also don't see why you're using it on a variable whose type is already a String. In any case, remove the line strRead.ToString(); it's only slowing down your code.
  18. Right; you do not need the StreamWriter.
  19. System.Diagnostics.Process.Start("url")
  20. [mshelp]ms-help://MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetSocketsTcpListenerClassTopic.htm[/mshelp]
  21. You can declare them as Overloads if you want, but the compiler will figure it out itself if you don't. So yes, you can change the parameters. The <>'s (which are []'s in C#) represent an Attribute. Attributes are special... attributes (for lack of a better word) which you can add to the declaration of any class, method, etc. (assuming that attribute supports it; you wouldn't obviously put a DllImportAttribute, which imports a method from a DLL, on a class). [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaconAttributesOverview.htm]Read more here[/mshelp].
  22. Maybe this is what you're looking for... <Runtime.InteropServices.DllImport("kernel32.dll", EntryPoint:="RtlMoveMemory")> Public Shared Function CopyMemory(ByVal dest As String, ByVal source As String, ByVal length As Integer) As Integer ' Keep this empty End Function The DllImportAttribute is another way to call Windows APIs in .NET apps, just make sure the method you're attributing is static (Shared in VB.NET). Anyway, using this method (no pun intended) you can then created overloaded versions of it with different parameters.
  23. UploadFile() is only meant for when a form is being posted, and it requires a file from the local machine to be uploaded to the server (the Browse for file input tag), or any other time the server is expecting a file transfer over HTTP. File transferring is usually done over the FTP protocol. Unless you want to learn the FTP protocol and write some code to handle it with Sockets (and don't let me stop you!), this looks like a nice component that wraps it all up for you.
  24. Right-click on the toolbox, and click Customize Toolbox. Then you can add any ActiveX control to your Toolbox (for inclusion in any project; VS.NET will add the DLL reference automatically when you add the first control to the form). If it isn't ont he list, Browse for it.
  25. If I understand your question correctly, no, you should not need ASP.NET to put an XML file on the web. You could just create the document on the local computer and upload it to the server via FTP. Does that fit your situation? And, if you were to develop ASP.NET applications, then yes, you'd need PWS or IIS installed on your local machine to debug them.
×
×
  • Create New...