Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
B

Briga

@Briga
About
Posts
116
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How To RECORD VIDEO using VB.NET coding?
    B Briga

    It does capture video to AVI or WMV. There samples available on MSDN Library as well. But I suggest you also to have a look at the implementation presented on this site about capturing video with a DirectX class. Just use the search function on the code project and you'll get plenty of ideas. Like: http://www.codeproject.com/cs/media/directxcapture.asp (it's C# but you can simply use the DLL in VB.NET) This one will give you details about DirectX video capture: http://www.codeproject.com/directx/MPEG2\_Capture\_Device.asp Others are available.

    Visual Basic csharp help tutorial question

  • How To RECORD VIDEO using VB.NET coding?
    B Briga

    You have three options, at least: 1) Buy an OCX and read the code samples it come along with (i.e. Pegasus Capture Pro, or the Viscom I remember) 2) Install, read Microsoft DirectX SDK and browse the sample code provided 3) Write your own from scratch based on VfW (old, tough and I think pointless).

    Visual Basic csharp help tutorial question

  • How to use mscomm1
    B Briga

    You have at least two options depending which version of VS are you running: VS2005: Use My.Computer.Ports class to access and use COMx VS2003: You can use MSCOMM object or one of the available classes (also on this site) With VS2005 look in the official MSDN documentation for code samples With MSCOMM it's easier to find sample code (tons) with google With User classes (there are at least three around) sample code is provided with them. Briga

    Visual Basic help hardware tutorial question

  • How to solve the INSERT table error below
    B Briga

    It seems that the message tells the story. Or you set a non null value for bcId or you make it nullable in the DB.

    Visual Basic help tutorial

  • HOW CAN I PREVENT STRING VALUE IN TEXTBOX
    B Briga

    Have you check if there's a cancel property available under e? Otherwise strip last char in the text property.

    Visual Basic help question

  • Optional parameters and function description.
    B Briga

    Your first question has been asked lots of times just search this forum for it. The second one is well documented in the official help but basically: friend function X (optional byval s as integer = 1) as integer

    Visual Basic question csharp tutorial

  • How to stop ?
    B Briga

    If you state more specific questions you probably get more replies. Anyway if you mean how to interrupt a loop from outside in VB6 this a way: Declare a global variable like Alive as boolean Your loop will be:

    Alive=True
    While Alive
    (...)
    DoEvents
    End While

    In your button event: Alive=False That's it.

    Visual Basic help tutorial question

  • how to detect app killing
    B Briga

    in VB6 the event is Form_Unload but it looks like you don't have a running form. If that's the case you have to check your messaging queue for the WM_CLOSE and WM_QUIT

    Visual Basic tutorial question

  • how to detect app killing
    B Briga

    edwin164 wrote:

    is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing???

    AFAIK that's the only WM message. In the beginning the OS tries to close it in a polite way sending that message. Still you don't need to intercept the message since the framework provides you with a pre-built event for each form (Closing). That event allows you to cancel the closing with the Cancel argument. If the form is mandatory closed by an external event (OS) again the FW should give you the event Closed.

    Visual Basic tutorial question

  • How to set time AND date using datepicker?
    B Briga

    Joshua Quick wrote:

    This isn't going to work Briga. Even though the user is only entering time into the "dtpTime" DateTimePicker, this object still internally stores a month/day/year and is included in the returned ticks. So, adding the ticks of both the time and date DateTimePickers will push the resulting DateTime beyond the year 4000. Unless of course you are initializing dtpTime to the beginning of time.

    Yeah I believe you as I said I was going by heart. It did work something similar (the idea is by adding the two components). Anyway your solution seems more elegant and efficient than mine.

    Visual Basic help tutorial question

  • How to set time AND date using datepicker?
    B Briga

    I solved it in the past this way: Dim dtD as DateTime = dtpDate.Value Dim dtT as DateTime = dtpTime.Value Dim dtC as DateTime = dtD.AdTicks(dtT.Ticks) I'm not 100% sure about the code since I go by heart, but I'm 100% sure about the method used.

    Visual Basic help tutorial question

  • how to send text to another machine
    B Briga

    Have you looked at the articles on this website?: http://www.codeproject.com/vb/net/#Internet This one looks like about your search: http://www.codeproject.com/vb/net/TinyUDP.asp

    Visual Basic tutorial

  • how can i check my network is connected
    B Briga

    If you're under VS2005/FW2 then it's very easy. There's a specific Application event that pop ups whenever network connection status changes.

    Visual Basic sysadmin help question

  • Which of the following is faster
    B Briga

    It's rather easy.... test it! Do a 1000000 loop and clock it or in a smarter way use system ticks (read them before and after the loop, the difference is the elapsed time).

    Visual Basic question

  • Printing with vb.net (Urgent)
    B Briga

    The formally correct solution is probably the best one although is a bit more complex. But not too much. You have better to use a PrintDocument class. There's plenty of documentation and samples on MSDN and here as well. To summarize: 1) Create a desgin time a printdocument in the form (i.e. called pDoc) 2) Double click on it to open the editor in the printing function 3) Write the code to print your data (***) 4) From the button invoke the pDoc.Print method. (***) I'm not able to write the full code you need but it should be something with: e.graphics.drawstring for each text you want to print e.graphics.drawimage for each image you want to print. Here's an example from the documentation

    Public Class PrintingExample
    Inherits System.Windows.Forms.Form
    Private components As System.ComponentModel.Container
    Private printButton As System.Windows.Forms.Button
    Private printFont As Font
    Private streamToPrint As StreamReader

    Public Sub New()
        ' The Windows Forms Designer requires the following call.
        InitializeComponent()
    End Sub    
    
    ' The Click event is raised when the user clicks the Print button.
    Private Sub printButton\_Click(sender As Object, e As EventArgs)
        Try
            streamToPrint = New StreamReader("C:\\My Documents\\MyFile.txt")
            Try
                printFont = New Font("Arial", 10)
                Dim pd As New PrintDocument()
                AddHandler pd.PrintPage, AddressOf Me.pd\_PrintPage
                pd.Print()
            Finally
                streamToPrint.Close()
            End Try
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub    
    
    ' The PrintPage event is raised for each page to be printed.
    Private Sub pd\_PrintPage(sender As Object, ev As PrintPageEventArgs)
        Dim linesPerPage As Single = 0
        Dim yPos As Single = 0
        Dim count As Integer = 0
        Dim leftMargin As Single = ev.MarginBounds.Left
        Dim topMargin As Single = ev.MarginBounds.Top
        Dim line As String = Nothing
        
        ' Calculate the number of lines per page.
        linesPerPage = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics)
        
        ' Print each line of the file.
        While count < linesPerPage
            line = streamToPrint.ReadLine()
            If line Is Nothing Then
                Exit While
    
    Visual Basic csharp help tutorial

  • Sound
    B Briga

    Your question is rather vague: which framework version? What type of sound? If you're using VB2005 and have a wav file then the easiest way is using the my.computer.audio.play reference. The official documentation explain it well (and it's really plain vanilla).

    ' Usage
    My.Computer.Audio.Play(location)
    My.Computer.Audio.Play(location ,playMode)
    My.Computer.Audio.Play(data ,playMode)
    My.Computer.Audio.Play(stream ,playMode)
    ' Declaration
    Public Sub Play( _
    ByVal location As String _
    )
    ' -or-
    Public Sub Play( _
    ByVal location As String, _
    ByVal playMode As AudioPlayMode _
    )
    ' -or-
    Public Sub Play( _
    ByVal data As Byte(), _
    ByVal playMode As AudioPlayMode _
    )
    ' -or-
    Public Sub Play( _
    ByVal stream As System.IO.Stream, _
    ByVal playMode As AudioPlayMode _
    )

    Visual Basic csharp help tutorial question

  • Decimal Format
    B Briga

    Than it's more about rounding/truncating rather than formatting. If you want to truncate to a certain digit you can use several approaches, two are here: 1) Function TruncateToDecX(v as double,d as double) as double v=v/d v=int(v) v=v*d return (v) end function You use it passing v=1.1999 and d=0.01 (where you want to truncate) you get 1.19 2) Quick and dirty dim s as string=v.tostring s.substring(0,s.indexof(".")+2)

    Visual Basic help tutorial question

  • Decimal Format
    B Briga

    If you want to simply format have a look at the documentation of the formatstrings (i.e. tostring method documentation or format function).

    Visual Basic help tutorial question

  • change the caller form based on the result of the called form
    B Briga

    Well my code has an error or better it was missing the form2.showdialog (so that the next line is executed only after the form2 has been hidden/closed with the button). So if you replace .show with .showdialog then it works. Anyway if you want a more precise answer you should provide more precise informations. Which versione of FW are you using 1.x or 2? VS2003 or VS2005. In VS2003 you can refer to the calling form only if it's public declared. Module x public fmain as new frmMain end module then in the form2 button click event handler: fmain.textbox1.text = .... In VS2005 in most cases you can state immediatly the form without instancing it. This means you can have a direct access to frmMain (considering the previous example) unless you're running an instance created by you (than you fallback in the former case). Another way of doing it is by raising an event. In form2 you'll have: ... raisevevent OKClicked() and in form1 private sub ClickOnForm2() handles frm2.OKClicked me.textbox1.text = frm2.textbox1.text end sub or using parameters ... public class frm2eventargs inherits eventargs public t as string end class on form2 before you raise the event... dim e as new frm2eventargs e.t = (text to pass) raiseevent OKClicked(me,e) and then on the mainform private sub frm2OKClick(sender as object,e as frm2eventargs) handles frm2.OKClicked me.textbox1.text = t end sub So as you can see lot of options depending on the approach you want and what you're using.

    Visual Basic question

  • Can we change the heading of a datagrid?
    B Briga

    Your code seems correct to me (but when do you apply the tablestle? Before or after that if/endif block?). I'm sorry not to be more helpful ... but you know remotely is even more difficult.... :)

    Visual Basic database help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups