Jump to content
Xtreme .Net Talk

DiverDan

*Experts*
  • Posts

    645
  • Joined

  • Last visited

3 Followers

About DiverDan

  • Birthday 06/18/1950

Personal Information

  • Visual Studio .NET Version
    vb.net standard
  • .NET Preferred Language
    vb.net

DiverDan's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi Guys, Using the Printer Class it is not too hard to find all the installed printers and print drivers. But how can I find only the physical printers, like a Lexmark, HP, Epson, etc. Thanks, Dan
  2. It's been a while since I dug into this so please bear with me. As I remember, you'll need to look into the RTF code and do some string manipulation to set the selected RTF backcolor. Here's the code that I adapted for setting and de-setting a highlight to the selected RTF. Private Sub Add_Highlight(rtf As RichTextBox) If rtf.SelectedText.Length <= 0 Then Exit Sub Try Dim strRTF As String = rtf.SelectedRtf Dim startpos As Integer = strRTF.IndexOf("\uc1") - 1 Dim nextpos As Integer = strRTF.IndexOf("\pard\") + 6 Dim strResult As String If strRTF.IndexOf("highlight1\") < 0 Then strResult = strRTF.Insert(nextpos, "highlight1\").Insert(startpos, HighlightBlackRtf(Color.Yellow)) rtf.SelectedRtf = strResult Else 'if the text is already highlighted strResult = strRTF.Replace("{\colortbl;\red255\green255\blue0;}", "") strResult = strRTF.Replace("highlight1\", "") rtf.SelectedRtf = strResult End If Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub Private Function HighlightBlackRtf(ByVal c As Color) As String Dim strcol As String = "{\colortbl ;\red" & c.R & "\green" & c.G & "\blue" & c.B & ";}" Return strcol End Function I hope this will help you.
  3. Is gbxSecurityInfo the groupbox that has the controls that you want to loop through? If so then the code is correct. If not then you'll need to change gbxSecurityInfo to the correct groupbox. Another thought is; are you sure that the controls are part of gbxSecurityInfo's controls and not the form's? You might want to check that.
  4. Hi SonicBoomAu, The error is correct as the ErrorProvider accesses the control, not its string name. Try this instead: Dim Ctrl As Control Dim txtBox As TextBox Dim combo As ComboBox For Each Ctrl In Me.gbxSecurityInfo.Controls If TypeOf Ctrl Is TextBox Then txtBox = CType(Ctrl, TextBox) If txtBox.Text = String.Empty Then ' Display Error Icon next to control ErrorProvider1.SetError(txtBox, "This field can not be left blank") Else ErrorProvider1.SetError(txtBox, "") End If 'Txt.Text = String.Empty Then End If ' TypeOf CTRL is TextBox If TypeOf Ctrl Is ComboBox Then combo = CType(Ctrl, ComboBox) If combo.Text = String.Empty Then ' Display Error Icon next to control ErrorProvider1.SetError(combo, "This field can not be left blank") Else ErrorProvider1.SetError(combo, "") End If 'Cbo.Text = String.Empty Then End If ' TypeOf Ctrl Is ComboBox Then Next
  5. Thanks Marble Eater, With your help I got it working perfectly. Thanks again, Dan
  6. Hi, I'm having a problem programmably increasing a panel's AutoScrollPosition. With the lower code, the auto scroll vibrates up and down instead of progressing constantly downward. Private Sub bkrTemp_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles bkrTemp.MouseMove Dim pt As Point pt.X = Me.PointToClient(Cursor.Current.Position).X - x pt.Y = Me.PointToClient(Cursor.Current.Position).Y - y With bkrTemp .Location = pt .Capture = True End With If pnlPanel.AutoScroll = True Then Dim bkrLocY As Integer = bkrTemp.Location.Y - (pnlPanel.Location.Y + pnlPanel.AutoScrollPosition.Y) + bkrTemp.Height Dim pnlHeight As Integer = pnlPanel.Height - (pnlPanel.AutoScrollMargin.Height + 17) If bkrLocY + 2 >= pnlHeight Then pnlPanel.AutoScrollPosition = New Point(pnlPanel.AutoScrollPosition.X, pnlPanel.AutoScrollPosition.Y + 5) End If End If End Sub How can I have pnlPanel scroll constantly downward with bkrTemp? Thanks, Dan
  7. Marble eater, you'd be better off re-reading the original post a couple of more times than posting ridiculous comments that are just plain wrong...again.
  8. This is too simple....Techmanbd's right though, you should show some attempt to solving your problem. But this one is too simple. In your Add button sub: If ckShirt.Checked Then 'add shirt cost ElseIf ckHat.Checked Then 'add hat cost ElseIf ckShoes.Checked Then 'add shoes cost End If
  9. From the print page sub: e.Graphics.DrawImage(image, point, etc.) It all depends on where it's to be drawn, where you're getting the image from, the quality of the drawn image, the size of the image, etc.
  10. It seems that PlausiblyDamp's link is broken, atleast on this computer anyway. Try: System.Diagnostics.Process.Start("E:\program.exe"). There are a lot of other ways to start your file including parameter settings etc. Check out the Process namespace.
  11. Well you're right SimDuck, can't do it with a dll. But I did create an exe that would. From you're current form's button click sub: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If System.IO.File.Exists(Application.StartupPath & "\DeleteExe.exe") Then System.Diagnostics.Process.Start(Application.StartupPath & "\DeleteExe.exe") End If End Sub Then with a new project named DeleteExe, set the form to bordless with a size of 0,0 In its Form Load sub: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim proc As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("WindowsApplication1") If proc.GetUpperBound(0) >= 0 Then proc(0).Close() If System.IO.File.Exists(Application.StartupPath & "\WindowsApplication1.exe") Then System.IO.File.Delete(Application.StartupPath & "\WindowsApplication1.exe") End If End If Me.Close() End Sub I don't know if this will fix your application, but it works. And exchange "WindowsApplication1" with your project's exe name. Also, this example only deletes the calling program. You can obviously change the deleation process to a directory.
  12. One very simple thought is to have your .exe app call a .dll app on closing. The .dll app would start with a timer then delete the required directory.
  13. I could be wrong but ("J:\OperationsGenie\JobsHelp\Monday\ThirdShift\{0}.rtf" looks like an .rtf file to me and not an executable.
  14. You'll need to load the file with a stream reader into a variable. Then close the stream reader to release the file for deletion.
  15. Another way is to use the .WaitForExit properity with pApp.
×
×
  • Create New...