Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. Windows or web control?
  2. You may want to investigate Webservices in that case as it will allow your system to be called via a network connection.
  3. Did you add the imports statement I mentioned as well - it should work if you did. Also did you try using Application.SartupPath and putting them in the same directory as the executable? Either of those ways should work. If you are having problems then posting the code in question or the errors raised will give people more chance to help.
  4. All you need to do is assign a dialog result to the buttons through the form designer.
  5. http://www.ascii.cl/ seems to be a pretty good ASCII chart - should find what you need in there. One way to make text right aligned is the following (note the final parameter) MessageBox.Show("Blah", "df", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign) although if you really want more control over the appearance you may want to design your own form instead of using a messagebox.
  6. Just a rehash of the link I posted... Dim ico As Icon ico = New Icon(([Assembly].GetExecutingAssembly().GetManifestResourceStream("WindowsApplication1.Icon1.ico"))) Me.Icon = ico you will need to change WindowsApplication1 to the namespace for your application and Icon1.ico to whatever the icon is called. Also add Imports System.Reflection to the top of the module
  7. You could put the icon in the applications directory and use a path of Application.StartupPath & "\icon.ico" or alternatively you could embed the icon into the executable. http://www.xtremedotnettalk.com/showthread.php?s=&threadid=75889&highlight=embedded+resource
  8. You could pass the integer by reference to a sub or function private sub DoThing(ByRef i as integer) end sub 'elsewhere you could use dim Test as integer DoThings(Test) 'This would pass a reference to Test to the sub. it may be easier if you give a better idea of what you are trying to do and why you feel you need pointers. [/code]
  9. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vakeydirectcast.asp WebRequest.Create() actually returns a System.Net.WebRequest not HttpWebRequest - CType is forcing the conversion to the correct object type. By default this is not required in VB as it will attempt conversions for you - this however can cause subtle bugs to creep in. If you follow the good practice of always using Option Strict On in your code these automatic conversions will fail, you have to tell the system what you want it to do. A bit more work but far more reliable code. the example code you presented is not a good example of casting though: DirectCast will only do conversions between them if they are of a compatible run-time type (either a common interface or part of the same inheritance heirachy). CType will convert if any supported conversion exists. In the example you provided HttpWebRequest is a sub class of WebRequest and as such DirectCast would have been a better choice. Dim wr As HttpWebRequest = DirectCast(WebRequest.Create("Http://"), HttpWebRequest) In practice I tend to avoid CType for a couple of reasons DirectCast is faster than CType and can be a lot safer when the above mentioned conditions are met. Using a type specific conversion (Integer.Parse, Long.ToString, Convert.ToInt32 etc) is again safer and faster than the more generalised CType.
  10. http://www.xtremedotnettalk.com/showthread.php?s=&threadid=73095&highlight=ctype+directcast http://www.xtremedotnettalk.com/showthread.php?s=&threadid=70566&highlight=ctype+directcast http://www.xtremedotnettalk.com/showthread.php?s=&threadid=80277&highlight=ctype+directcast
  11. Found a small bug and also added a property to allow the autocomplete to be turned on or off. Public Class AutoCompleteComboBox Inherits System.Windows.Forms.ComboBox Protected _AutoCompleteEnabled As Boolean = True _ Public Property AutoCompleteEnabled() As Boolean Get Return _AutoCompleteEnabled End Get Set(ByVal Value As Boolean) _AutoCompleteEnabled = Value End Set End Property Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs) If _AutoCompleteEnabled = True Then 'Only do something if autocomplete is enabled Dim sText As String = Text Dim i As Integer If e.KeyChar = Convert.ToChar(Keys.Back) Then If Text.Length = 0 Then Return 'Don't backspace when nothing there Text = Text.Substring(0, SelectionStart - 1) sText = Text End If i = FindString(sText) If i >= 0 Then SelectedIndex = i [select](sText.Length, Text.Length) End If End If MyBase.OnKeyPress(e) End Sub End Class
  12. Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.Modifiers = Keys.CapsLock Then 'caps lock pressed End If End Sub also you gave this thread a bit of a misleading title as it doesn't really have anything to do with ascii.
  13. also you could have used writer.WriteLine(.....) instead of appending the linefeed yourself - this would aid portability to other .Net languages which may not support the VB constants.
  14. http://www.xtremedotnettalk.com/showthread.php?s=&postid=401084#post401084 also using the first unread post link seems to work.
  15. dynamic_sysop has a sample in the code library that downloads an image file from a url and gives the size / size downloaded. Have a look there - the code is pretty straight forward. (don't forget to thank him either :D )
  16. If formneedsdrawing.visible = false will tell you if the form is hidden or not.
  17. For x = 0 To MyArray.GetUpperBound(0) -1 'some stuff here Next x is the equivalent of ubound, also you could use a for each loop dim s() as string 'redim s and add things etc. dim x as string for each x in s 'Do stuff next
  18. http://www.xtremedotnettalk.com/showthread.php?s=&threadid=74805&highlight=application.run+form
  19. By the looks of it in the editor form you are declaring a new instance of findTextForm, but as part of findTextForm you are declaring a new instance of the editor form. Note the lines Dim theForm As New findTextForm and Dim baseForm As New Form1 (which i'm assuming is editor - correct?) if so each will create an instance of the other until you run out of stack space - hence the error you got. Does the findTextForm need to refer to the editor form? if so you should pass an instance of the editor to the findTextForm. in the findTextForm change Dim baseForm As New Form1 to Dim baseForm As Form1 and change it's sub new from ublic Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub to Public Sub New(f as Form1) MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call baseForm =f End Sub and finally in editor change ' Loading of form data (removed, too long) Dim theForm As New findTextForm to ' Loading of form data (removed, too long) Dim theForm As New findTextForm(me) and see if that helps. If i'm wrong about editor being form1 then adjust accordingly.
  20. You could add a FileSystemWatcher to your application from the toolbox, that will allow you to monitor file system events.
  21. Same here - when dealing with people online there is always that urge for a few minutes more.... Also if you want to stop is inviting people to join you in a game really a good plan :D
  22. probably the OO way of doing things would be to create an interface (IReload or similar) and get each of your child forms to implement this. //interface declaration public interface IReload { void Reload(); } in each child form use the following idea as the form declaration (if you are not inheriting from a System.windows.Forms.Form then adjust accordingly public class Form1 : System.Windows.Forms.Form, IReload then you could create a for each loop similar to the following foreach (Form f in MdiChildren) { IReload ir = f as IReload; if(ir != null) ir.Reload(); } this way if a child doesn't need to be forced to refresh - don't implement the interface. If it does implement it and provide the Reload method and it should work :-\
  23. It looks like the ASPNET account doesn't have permisions to the database, you will need to grant DB permissions to GRACE\ASPNET to allow the server access to the DB.
  24. Unfortunately the ASP.Net runtime stores it's session variables seperate to the ASP runtime so they cannot see each others. This is a result of how ASP.Net state management has been improved (now works across web farms etc). How much data is being stored in these session variables - two possible fixes are if the data is small pass as a query string or if large shove it into a database and pass a reference across in the query string.
×
×
  • Create New...