Luc001 77 Posting Whiz

Hi,

You should do it like this:

In form1 you need a button to show your form2 like this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fr As New Form2
        fr.Show()
    End Sub

In form2 you can do it like this:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim y As Integer
        y = Form1.TextBox1.Text
        Dim x As Integer
        x = Form1.TextBox2.Text

        Label1.Size = New Size(y, x)
    End Sub
Luc001 77 Posting Whiz

Hi,

You can find some information about to send SMS via PC to Mobile, here.

Luc001 77 Posting Whiz

Hi,

You can try this:

Private Declare Function SetWindowsHookEx _ 
 Lib "user32" Alias "SetWindowsHookExA" ( _ 
 ByVal idHook As Long, _ 
 ByVal lpfn As Long, _ 
 ByVal hmod As Long, _ 
 ByVal dwThreadId As Long) As Long 
   
Private Declare Function CallNextHookEx Lib "user32" ( _ 
 ByVal hHook As Long, _ 
 ByVal nCode As Long, _ 
 ByVal wParam As Long, _ 
 ByVal lParam As Long) As Long 
 
Private Declare Function UnhookWindowsHookEx Lib "user32" ( _ 
 ByVal hHook As Long) As Long 
 
Private Declare Sub CopyMemory _ 
 Lib "kernel32" Alias "RtlMoveMemory" ( _ 
 pDest As Any, _ 
 pSource As Any, _ 
 ByVal cb As Long) 
 
Private Type KBDLLHOOKSTRUCT 
    vkCode As Long 
    scanCode As Long 
    flags As Long 
    time As Long 
    dwExtraInfo As Long 
End Type 
 
Private Const HC_ACTION = 0& 
Private Const WH_KEYBOARD_LL = 13& 
Private Const VK_LWIN = &H5B& 
Private Const VK_RWIN = &H5C& 
 
Private hKeyb As Long 
 
Private Function KeybCallback(ByVal Code As Long, ByVal wParam As Long, ByVal lParam As Long) As Long 
    Static udtHook As KBDLLHOOKSTRUCT 
     
    If (Code = HC_ACTION) Then 
        'Copy the keyboard data out of the lParam (which is a pointer) 
        Call CopyMemory(udtHook, ByVal lParam, Len(udtHook)) 
        Select Case udtHook.vkCode 
            Case VK_LWIN, VK_RWIN 
                KeybCallback = 1 
                Exit Function 
        End Select 
    End If 
    KeybCallback = CallNextHookEx(hKeyb, Code, wParam, lParam) 
End Function 
 
Public Sub HookKeyboard() 
    UnhookKeyboard 
    hKeyb = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf KeybCallback, App.hInstance, 0&) 
End Sub 
 
Public Sub UnhookKeyboard() 
    If hKeyb <> 0 Then 
        Call UnhookWindowsHookEx(hKeyb) 
        hKeyb = 0 
    End If 
End Sub
Luc001 77 Posting Whiz

Hi John,

Glad it works now :)

Mark this thread as resolved.

Luc001 77 Posting Whiz

Hi,

No problem, glad to help, use the arrow to vote the answers.

Luc001 77 Posting Whiz

Hi John,

I did some testing and this works like it should, that means that if the file exist it only saves the new added sentences.
This is the tested codes:

Dim strFileName As String
    Dim strFilePath As String = ".\"
 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
       
        SaveFileDialog1.Filter = "Text Docs(*.txt)|*.txt|All Files(*.*)|*.*"
        SaveFileDialog1.FilterIndex = 2
        SaveFileDialog1.RestoreDirectory = True


        If strFileName Is Nothing Then
            If SaveFileDialog1.ShowDialog = DialogResult.OK Then
                txtBox.SaveFile(Me.SaveFileDialog1.FileName)
                strFileName = Me.SaveFileDialog1.FileName
            End If
        Else
            txtBox.SaveFile(strFileName)
        End If
    End Sub

' this part of code I used for the Save As event.

 Private Sub btnsaveas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsaveas.Click

        SaveFileDialog1.Filter = "Text Docs(*.txt)|*.txt|All Files(*.*)|*.*"         SaveFileDialog1.FilterIndex = 2
        SaveFileDialog1.RestoreDirectory = True

        If SaveFileDialog1.ShowDialog = DialogResult.OK Then
            txtBox.SaveFile(Me.SaveFileDialog1.FileName)
            strFileName = Me.SaveFileDialog1.FileName
        End If
    End Sub
Luc001 77 Posting Whiz

Hi,

If you want to thank me use the arrow keys :)

Now for the saving problem you can try this:

Dim strFileName As String
              Dim strFilePath As String = ".\"
    
        SaveFileDialog1.Filter = "RTF Files|*.rtf|All files|*.*"
        SaveFileDialog1.FilterIndex = 2
        SaveFileDialog1.RestoreDirectory = True

        ' Save the file
        If strFileName Is Nothing Then
            If SaveFileDialog1.ShowDialog = DialogResult.OK Then
                txtBox.SaveFile(Me.SaveFileDialog1.FileName)
                strFileName = Me.SaveFileDialog1.FileName
            End If
        Else
            txtBox.SaveFile(strFileName)
        End If

I hope it helps.

Luc001 77 Posting Whiz

Hi,
To create a texteditor you should use a richtextbox in stead of a textbox.
But you can try the codes I gave you for a richtextbox !

For the textcolor, change the code into this:

If ColorDialog1.ShowDialog = DialogResult.OK Then            
txtBox.SelectionColor = ColorDialog1.Color        
End If

For the font , change it into this:

If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            txtBox.SelectionFont = FontDialog1.Font
        End If
Luc001 77 Posting Whiz

Hi,

You can find some more explanation about dialogboxes in vb.net, here.

Luc001 77 Posting Whiz

Hi,

Can you show us what you have.
So we can see a little effort from you as well.

Luc001 77 Posting Whiz

Hi

Also guys please tell me if there is any website where i can get tutored visual basic....please

You can find some tutorials for VB 2008, here.

Luc001 77 Posting Whiz

Hi,

For your first question:

Kindly help me about these problems that what a coding for lock the form in runtime and user no adjsut form witdth or length

You doesn't need a code for that, go to the form property and select Formborderstyle = FixedSingle.
That means that you can't resize the form during runtime, but you can use the minimize, maximize and close buttons of the form.

If you select FormBorderstyle = FixedToolWindow then you can't resize the form and you can only use the close button of the form.

For your second question:
What do you have already?

Luc001 77 Posting Whiz

Hi,

You can find an example, how to create a login form, here.

Luc001 77 Posting Whiz

Hi,

You can find a convertor, here.

But I never tryed.
So, don't shoot the piano player :)

Luc001 77 Posting Whiz

Hi,

What you can try, I haven't had that problem yet.
Go to the solution explorer, right click your application and rebuild your application and then save all.

I hope it helps.

Luc001 77 Posting Whiz

Hi,

Probably the login form is your first form (form1).
That means that if you didn't changed the shutdown mode your application will shutdown completely.

The solution is: change the shutdown mode into 'when last form closes' and it will open the next form.

Luc001 77 Posting Whiz

Hi,

If your using Vb 2005 express edition you can find a good tutorial how to create an access database, here.

It should work for VB 2008 express edition as well.

Luc001 77 Posting Whiz

Hi,

You can find a tutorial, how to design and sample codes, here.

Luc001 77 Posting Whiz

Hi,

You can find some information, here.

Luc001 77 Posting Whiz

Hi,

For your second question, you need to use this in the load event of your Form1:

Picturebox1.Image=My.Resources.imagename

In your form2 you can show it like this:

PictureBox1.Image = Form1.PictureBox1.Image
Luc001 77 Posting Whiz

Hi,

For your first question, you can do it like this:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = Form1.TextBox1.Text

    End Sub
Luc001 77 Posting Whiz

Hi,

You can find some information, here.

Luc001 77 Posting Whiz

Hi,

meffe beat me on this one ;)

Luc001 77 Posting Whiz

Hi,

No problem glad to help, mark your thread as solved.

Luc001 77 Posting Whiz

Hi,

You can try this:

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        NameTextBox.Text = (NameTextBox.Text & "M")
    End Sub
Luc001 77 Posting Whiz

Hi,

Here's something I made with numbers.

Private Sub Digit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttn1.Click, bttn2.Click, bttn3.Click, _
    bttn4.Click, bttn5.Click, bttn6.Click, bttn7.Click, bttn8.Click, bttn9.Click, bttn0.Click
      
        lblDisplay.Text = lblDisplay.Text + sender.Text
    End Sub

Like you can see it's for numbers.
Add ten buttons and name them like I did, set there text from 1 to 0 and to show the result I used a label with name lblDisplay.

Way you need to set the focus for some textboxes?

Luc001 77 Posting Whiz

Hi,

You can find a password generator with numbers and upper- and lowercase characters, here.

Luc001 77 Posting Whiz

Hi,

When you have created a new image folder in the Bin folder of your application, then you need to use this part of code. foldername is your image folder and imagename is the image you want to load at first.

PictureBox1.Image = System.Drawing.Image.FromFile(Application.StartupPath & "\foldername\imagename.jpg")

However, when you added directly your image in the bin folder then you need to use the code like this:

PictureBox1.Image = System.Drawing.Image.FromFile(Application.StartupPath & "\imagename.jpg")
Luc001 77 Posting Whiz

Hi,

You can do it also with times used, look here for an example.

Luc001 77 Posting Whiz

Hi,

You can do it like this:

For Each frmApproval As Form In Me.MdiChildren
            frmApproval.Close()
 Next
Luc001 77 Posting Whiz

Hi,

Or you can use the application StartupPath.

'First , add reference to ShockWave Flash Object Library
'existed on the COM Tab . Paste the control on your form.
'Use the code below as follow : 
'Add your flashfile to the Bin folder

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With FlashObj
            .Stop()
            .Movie = Application.StartupPath & "\nameofyourflashfile.swf"
            .Play()
        End With
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        FlashObj.Dispose()
        Application.Exit()
    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
Luc001 77 Posting Whiz

Hi,

You can find some explanation, how to send SMS with VB.Net, here.

You can find some more by Uncle Google :)

Luc001 77 Posting Whiz

Hi,

Add this in the Radiobutton event in your Form1.
To test it I gave the radiobutton this name: RadioButtonName

If Not RadioButtonName.Checked Then
            Form2.TxBxPRICE.Text = "100"
        Else
            Form2.MonPrice = 120
            Form2.ListBox1.Items.Add(RadioButtonName.Text)

            Form2.TxBxPRICE.Text = Val(Form2.TxBxPRICE.Text + Form2.MonPrice)

        End If
Luc001 77 Posting Whiz

Hi,

Looks like the .Net MultiMediaControl isn't for free, look here.

What you can do is add the Windows mediaplayer control.

Luc001 77 Posting Whiz

Hi,

I've tryed to convert your code.
Here's the result:

Public Class PostCalendar    
Inherits Calendar
   Implements ICallbackEventHandler
    
    Shared Sub New()
        Post.Saved += Post_Saved
    End Sub
    
    Public Class RecentComments
        Inherits Control
        
        Shared Sub New()
            BindComments()
            Post.CommentAdded += Function() Do
                BindComments()
            End Function
           Post.CommentRemoved += Function() Do
                BindComments()
            End Function
            AddHandler Post.Saved, AddressOf Post_Saved            
Comment.Approved += Function() Do
                BindComments()
            End Function
            BlogSettings.Changed += Function() Do
                BindComments()
           End Function
       End Sub
        Public Class TagCloud
           Inherits Control
           
            Shared Sub New()
               Post.Saved += Function() Do
                   _WeightedList = Nothing
               End Function
           End Sub
       End Class
    End Class
End Class

I couldn't test it, but I hope it will do.

Luc001 77 Posting Whiz

Hi,

What's the error your reseiving?

Can you post the original code in C#.

Luc001 77 Posting Whiz

Hi,

You can show only the date like this:

Dim Custom As String
        Custom = Now.ToString("MM/dd/yyyy") ' only date
        TextBox5.Text = Custom
Luc001 77 Posting Whiz

Hi,

If the value for TxBxPRICE.Text is coming from a Form1 value.
The you can try something like this if the value is coming from a Textbox:

TxBxPRICE.Text = Form1.Nameoftextbox.Text
Luc001 77 Posting Whiz

Hi,

You can't do web apps with Visual Basic 2008 Express, only desktop apps, but you can download Visual Web Developer Express to do web apps. Web Developer Express is also free.

You can find some information and download Wb Developer Express, here.

Luc001 77 Posting Whiz

Hi,

You should do it like this:

Public Class Form1
    Dim MonPrice As Decimal


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
    End Sub

    Private Sub RadioBtnMon20_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioBtnMon20.CheckedChanged
        If Not RadioBtnMon20.Checked Then
            TxBxPRICE.Text = "100"
        Else
            MonPrice = 120
            ListBox1.Items.Add(RadioBtnMon20.Text)

            TxBxPRICE.Text = Val(TxBxPRICE.Text + MonPrice)

        End If
    End Sub

    Private Sub RadioBtnMonHd_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioBtnMonHd.CheckedChanged
        If Not RadioBtnMonHd.Checked Then

            TxBxPRICE.Text = "100"
        Else
            MonPrice = 140
            ListBox1.Items.Add(RadioBtnMonHd.Text)
            TxBxPRICE.Text = Val(TxBxPRICE.Text + MonPrice)
        
        End If
    End Sub

    Private Sub RadioBtnMonFullHD_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioBtnMonFullHD.CheckedChanged
        If Not RadioBtnMonFullHD.Checked Then

            TxBxPRICE.Text = "100"
        Else
            MonPrice = 170
            ListBox1.Items.Add(RadioBtnMonFullHD.Text)
            TxBxPRICE.Text = Val(TxBxPRICE.Text + MonPrice)
        End If
    End Sub
End Class
Luc001 77 Posting Whiz

Hi,

I forgot a variable and then you'll get an error. Add this one and it should work:

Private Const MOUSEEVENTF_LEFTUP As Integer = &H4
Luc001 77 Posting Whiz

Hi,

You need to change them like this:

Public Class Form1
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Form2.AdjOne.Text = txtONE.Text 
        Form2.NounOne = txtTWO 
        Form2.verbPTone=txtTHREE 
        Form2.AdvOne=txtFOUR 
        Form2.AdjTwo=txtFIVE 
        Form2.NounTwo=txtSIX 
       Form2.NounThree= txtSEVEN  
        Form2.AdjThree=txtEIGHT 
        Form2.verbOne=txtNINE 
        Form2.AdvTwo=txtTEN 
        Form2.verbPTtwo=txtELEVEN  
        Form2.AdjFour=txtTWELVE
Luc001 77 Posting Whiz

Hi,

You can find more tutorials about Tic Tac Toe games on Google.
But this is another one, here.

Luc001 77 Posting Whiz

Hi,

Here's an example how to perform a Mouseclick:

Imports System.Runtime.InteropServices

Public Class Form1
    Inherits Form
    <DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Sub mouse_event(ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
    End Sub

    Private Const MOUSEEVENTF_LEFTDOWN As Integer = &H2

        Public Sub DoMouseClick()
        'Call the imported function with the cursor's current position
        Dim X As Integer = Cursor.Position.X
        Dim Y As Integer = Cursor.Position.Y
        mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, X, Y, 0, 0)
        TextBox1.Text = (" Cursor position: X:" & X & " " & "Y:" & "" & Y)

    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()
        Label1.Text = "0"
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        
        Label1.Text = Val(Label1.Text + 1)

        If Label1.Text = 10 Then
            DoMouseClick()
            Timer1.Stop()
        End If
    End Sub
End Class
Luc001 77 Posting Whiz

Hi,

You need a mousebutton click for some raison?

If you only want the position of your cursor then you don't need to perform a mouseclick. I've added a testbox to show you the coordinates of the cursor.

Public Class Form1

Public Declare Auto Function GetCursorPos Lib "User32.dll" (ByRef lpPoint As Point) As Integer
' This stores the cordinates of the mouse cursors location
    Dim mousepos As Point

    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
        tmrWatch.Start()
    End Sub

    Private Sub btnStop_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnStop.Click
        tmrWatch.Stop()
    End Sub
    Private Sub tmrWatch_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrWatch.Tick
        txtTenths.Text -= 1
        If txtTenths.Text = -1 Then
            txtTenths.Text = 9
            txtSeconds.Text -= 1
            If txtSeconds.Text = -1 Then
                txtSeconds.Text = 59
                txtMinutes.Text -= 1
                If txtMinutes.Text = -1 Then
                    txtMinutes.Text = 59
                    txtHours.Text -= 1
                    If txtHours.Text = -1 Then
                        txtHours.Text = 23
                        txtDays.Text -= 1
                        If txtDays.Text = -1 Then
                             Dim R As Long = GetCursorPos(mousepos) ' You'll get your location in mousepos
  TextBox1.Text = ("Mouse Cursor Location : " & " X: " & mousepos.X & " Y: " & mousepos.Y)

                            tmrWatch.Stop()
                            txtTenths.Text = "0"
                            txtSeconds.Text = "0"
                            txtMinutes.Text = "0"
                            txtHours.Text = "0"
                            txtDays.Text = "0"
                        End If
                    End If
                End If
            End If
        End If
    End Sub
Luc001 77 Posting Whiz

Hi,

I've made some changes and values to test your function.
Here's the result:

Public Class Form1
    Dim x As Integer = 50
    Dim i As Integer = 4
    Dim y As Integer
    Dim j As Integer = 10

    Sub DrawScreen()
        Dim gr As System.Drawing.Graphics = Me.CreateGraphics
        Dim myPen As New Pen(Color.Blue, 2)
        gr.DrawRectangle(myPen, (1 + x + (i * 4)), (y + (j * 4)), (1 + x + (i * 4) + 3), (y + (j * 4) + 3))
        Timer1.Start()

    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        DrawScreen()
    End Sub
End Class
Luc001 77 Posting Whiz

Hi,

No problem glad to help, mark your thread as resolved.

Luc001 77 Posting Whiz

Hi,

You can find some information in this thread.

Luc001 77 Posting Whiz

Hi,

Try something like this:

Dim theConnection As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=book1.xls;Extended Properties=""Excel 8.0;HDR=NO;IMEX=1;""")
theConnection.Open()
Dim theDataAdapter As New OleDbDataAdapter("SELECT * FROM [Sheet1$]", theConnection)
Dim theDS As New DataSet()
Dim dt As New DataTable()
theDataAdapter.Fill(dt)
Me.dataGridView1.DataSource = dt.DefaultView
Luc001 77 Posting Whiz

Hi,

In the button event start the timer and switch the relay on.
In the timer event create a counter to count the seconds the relay is on and switch then the relay off.