divil
*Gurus*-
Posts
3026 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by divil
-
If you want to hide the form and show the system tray icon, you'd use what you already have: Me.NotifyIcon1.Visible = True Me.Hide()
-
Yes, it's a TCP connection just like a telnet one. There are .NET classes under System.Web.Mail but you said you wanted to send one directly using an SMTP server so I assumed you wanted to do it manually. There are examples of using the Socket class in the documentation and samples in the SDK.
-
Connect via a Socket class, then you'll need to have the following conversation with the SMTP server (port 25): < 220 Ready > MAIL FROM:myemail@mydomain.com < 250 Sender ok > RCPT TO:recipient@domain.com < 250 Recipient ok > DATA < 354 Ok Send data ending with <CRLF>.<CRLF> > sample email line! > . < 250 Ok, sent > QUIT < 221 I suggest you read the SMTP RFC for more information on the protocol.
-
The enter key will press whatever button is set in the AcceptButton property of the Form. The space key will activate whatever button has the focus, which you can tab through using the tab key.
-
New lines in text box when copying attributes into it
divil replied to Dawson's topic in Windows Forms
You add Environment.NewLine as a seperator: Text1.Text = "Line 1" & Environment.NewLine & "Line 2" text1.Text = "Line 1" + Environment.NewLine + "Line 2"; -
Well, someone asked me to find a way to display line numbers next to a RichTextBox, so I knocked up this sample which seems to (roughly) do the trick. It wouldn't be hard to bump this up to spec, should you need it.richtextlinenumbers.zip
-
I just knocked up this sample as a quick example of how to use the power of GDI+ to rotate what you're drawing around an arbitrary point. Is also illustrates how the SmoothingMode can improve drawing quality when using rotations. rotations.zip
-
Introduction Data input validation in Windows Forms is essential. Built-in validation doesn't go much further than an enforcable maximum length for textboxes, but there are some nice methods you can use to make validation a breeze. When a user is tabbing fast through a dialog entering data, they are sometimes going to get it wrong. We're only human, and this is natural. When we do get it wrong, however, we don't want to be bugged about it. The last thing we need is for a Message Box to pop up when we tab away from a field, telling us it's invalid. That would be an unnecessary interruption. Also, we don't want all the validation done when the user presses the OK button, because they could then potentially be given a great big message with all the fields that are wrong. So what we need is a method of unobtrusively showing that data is invalid, and presenting it in such a way that it is immediately obvious what is wrong and what to do about it. Enter the ErrorProvider http://www.burk.co.uk/features/divil/images/errorprovider.gif This little Gem is often left unnoticed, which is a funny thing considering it sits in the Windows Forms Controls Toolbox by default. It is a component rather than a control, so when you put it on your form it will sit in the component tray below. What this component can do is display a little red icon beside any control which is invalid. When the user hovers their mouse over this icon a tooltip is instantly displayed with information about the invalid field. It can also optionally blink the icon. While this may sound trivial, it's actually rather useful. Using it on a form Create yourself a form, with a textbox on it. Put an ErrorProvider in your component tray too. Now, in the Validating event of the textbox you need to put the code to test the contents for validity and optionally display the error icon. It's up to you how you do your validation, it could be as simple as text length constraints or as advanced as regular expressions matching. You use the errorProvider.SetError method to assign an error to a control. If your control is found to be invalid, use errorProvider.SetError(myControl, "My error text");. To clear the error, simply pass an empty string. An example which just checks to see if any data has been entered: private void txtTown_Validating(object sender, System.ComponentModel.CancelEventArgs e) { if (txtTown.Text.Trim().Length == 0) errorProvider.SetError(txtTown, "Please enter the customer's town."); else errorProvider.SetError(txtTown, ""); } You can have as many error providers on a form as you wish, but I can only see a potential use for two. You could have one with a yellow icon rather than red, for when a field is valid but could be better. Example code I have attached a sample project written in C#, which has a typical (though simplified) data entry form for some customer information. You will find as you tab through the textboxes on the form, that you will get the error icon appearing unless you enter data in the right format. Hovering the mouse over the error icon will tell you what is wrong and how to fix it. errorprovider.zip
-
If myListbox.SelectedIndex = -1 Then 'Selected nothing
-
Very nice. I know the person who wrote the original donuts sample in the SDK :)
-
fixed array inside a structure
divil replied to SleepyTim's topic in Interoperation / Office Integration
You won't find a way to change the way VB.NET handles arrays in structures, but you WILL find a way to make it marshal the structure correctly to your DLL. At this point you may want to tell us more about your DLL and what it's expecting, but you can use attributes to make sure that when your structure is passed, any arrays are passed with all their values sequentially, just like you need. < StructLayout( LayoutKind.Sequential )> _ Public Structure MyArrayStruct Public flag As Boolean < MarshalAs( UnmanagedType.ByValArray, SizeConst:=3 )> _ Public vals As Integer() End Structure 'MyArrayStruct Can I suggest looking at the MSDN page under Programming .NET -> Interoperating -> Interop Marshaling -> Platform Invoke -> Structs Or, if you have the SDK installed, [mshelp]ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpconstructssample.htm[/mshelp] -
I'm sorry, I'm out of ideas then. As far as I recall you could install VS.NET without installing the Frontpage Extensions, but ASP.NET wouldn't work right. Maybe you could look in to command-line switches for the installer and see if there's a way to skip the check.
-
You'll have to be a little less vague first. We need to know what you want to do, why you want to do it, what you've already tried and why this didn't work (including errors).
-
Go ahead and post them (source, not binaries, of course). It will be interesting to compare them when managed DX9 comes out.
-
Transferring data through internet in VB.net without using ASP.Net
divil replied to whizkid123's topic in Network
whizkid123, your failures at time management do not result in an enforcable contract from this forum. That said, if your application is on the client-side, how is the platform on the server-side relevant? -
Do show a dialog modally (I think this is what you want to do) you use the ShowDialog method of the Form class: blah = New Form2() blah.ShowDialog(Me)
-
I assume you actually have IIS installed?
-
As a quick bodge, this seems to work: Private Sub rtb_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles rtb.MouseUp Dim intSelPos As Integer Dim intSelStart, intSelLength As Integer intSelPos = rtb.SelectionStart intSelStart = rtb.Text.LastIndexOf(ControlChars.Lf, intSelPos) If intSelStart = -1 Then intSelStart = 0 intSelLength = rtb.Text.IndexOf(ControlChars.Lf, intSelStart + 1) - intSelStart If intSelLength < 0 Then intSelLength = rtb.Text.Length - intSelStart If intSelStart = 0 Then intSelStart = -1 intSelLength += 1 End If rtb.SelectionStart = intSelStart + 1 rtb.SelectionLength = intSelLength - 1 End Sub
-
This is a known problem and has to do with GDI+ and clipping. The only solution that works is to change the Font of the treeview itself to bold, and then each node added that is NOT bold changed to reflect that as you add it.
-
Well well... I stand corrected.
-
It doesn't get much quicker than that I'm afraid!
-
When you create an installer for your application using the VS.NET deployment project type, it will refuse to install unless the framework is there, which is a good start.
-
I don't, but perhaps someone else will. It won't get more complex than reading the HTTP RFC, connecting to the webserver on port 80, issuing a GET request for the file, examining the Content-Length header then storing the data as you receive it.
-
You may well find yourself having to write the code to connect to the webserver using a Socket or TcpClient yourself, I'm not aware of a framework method to download files from http and give transfer progress.
-
Sub Mains don't have to exist in modules :) Friend Class Moo Public Shared Sub Main() End Sub End Class