Luc001 77 Posting Whiz

Hi,

No problem, let me now if it works.

Luc001 77 Posting Whiz

Hi,

Add a label in designtime and place it above the datetimepicker, just like Codeorder showed.

In the properties of the label set the text: - Please Select Date - and the textalign = center.

That's all.

codeorder commented: thanks +1
Luc001 77 Posting Whiz

Hi,

In the properties of the textboxes you doesn't want the focus set Tabstop = False
For the textbox set Tabindex = 0

hercx commented: thanks +2
Luc001 77 Posting Whiz

Hi,

First the proper link, look here.

I think:

'textBox1.Text=fdlg.FileName

is a typo.

Try this:

Dim fdlg As New OpenFileDialog

fdlg.Title = "C# Corner Open File Dialog"
fdlg.InitialDirectory = "c:\"
        fdlg.Filter = "Word Documents (*.Doc)|*.Doc|txt files (*.txt)|*.txt|All files (*.*)|*.*"
fdlg.FilterIndex = 2
fdlg.RestoreDirectory = True
If fdlg.ShowDialog() = DialogResult.OK Then
TextBox1.Text = fdlg.FileName

fdlg.OpenFile()
End If
Luc001 77 Posting Whiz

Hi,

You can use the OpenfileDialog Class for that.
You can find some explanation and example, here.

Luc001 77 Posting Whiz

Hi,

You can find an example, here.

Luc001 77 Posting Whiz

Hi,

Did you had some errors?
How did you used that part of code?
...

Luc001 77 Posting Whiz

Hi,

Create a form and change in the properties:

borderstyle = Fixedtoolwindow
Controlbox = False
Startposition= centerscreen

Then add the buttons you need for your application.

Just a thought :)

Luc001 77 Posting Whiz

Hi,

A string containing the column name followed by "ASC"(ascending) or "DESC"(descending) will change the datatable order.
The columns are sorted ascending by default.

Luc001 77 Posting Whiz

is there anyway that i can place an object in a specific coordinates in vb?

Hi,

When you speek about coordinates with Mapping, then I think of Latitude and Longitude.
You can find some tutorial, here.

Luc001 77 Posting Whiz

Hi,

You can try something like this:

Me.DataGridView1.Rows.Insert(0, value1, value2) ' values you entered

Didn't tested it

Luc001 77 Posting Whiz

Hi,

You should try something like this:

Dim item As ListItem
	For Each item In ListView1.ListItems
		If item.Selected = False Then
			'do your stuff here
		End If
	Next
Luc001 77 Posting Whiz

Hi,

I think you can find some information, here. And specially step 3 .

Luc001 77 Posting Whiz

Hi,

Mark this thread as solved when it answered your problem.

Luc001 77 Posting Whiz

Hi,

Yu can find some VB 2008/2010 tutorials, here.

There some good books depending on the VB version on the net.

Luc001 77 Posting Whiz

Hi,

For your second question, use this in a button event:

System.diagnostics.Process.Start("shutdown", "-s") 
' Will cause the computer to shutdown
Luc001 77 Posting Whiz

Dear Sir/Madam,

I have two form in my application form1 and form2. Here, i want to show the form2 from form1 by using a button. And i want to reverse back to my form1 from form2 using same technique. But i want to close form1 (Not visible=false or hide) after loading form2 and same thing in reverse back also.

I have tried like this....

'for from1
form2.show()
'form1.close ' not accepted
me.close

In my above code whole application is closing.

'for form2
form1.show()
me.close()

Here it is working in form2

I want to know that can we close our current form after showing another form? Please guide me.

Hi,

You just need to go to the properties of your application and set:

Shutdownmode = When last form closes

Your application will only close when last form closes.

Luc001 77 Posting Whiz

Guys how do I save settings of a form like its background color, fonstyle, sontsize etc. I cannot save them as string or text into my access database.

Hi Mark,

You can also try to do this with the My.Settings object.
You can find some information,here.

Luc001 77 Posting Whiz

Hi,

You should try something like this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If CheckBox1.Checked = False Or TextBox1.Text = "" Then
            MsgBox("Error, You forgot something")
        Else
            MsgBox("Progressbar coding goes here")
        End If
    End Sub
debasisdas commented: to the point answer. +8
Luc001 77 Posting Whiz

thanks animal mother. it paints tabpage header. but it doesnt paint remaining part of the tab control... is ther any solution to this..

Hi Ashu26,

You can do it like this;

Private Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
        'Firstly we'll define some parameters.
        Dim CurrentTab As TabPage = TabControl1.TabPages(e.Index)
        Dim ItemRect As Rectangle = TabControl1.GetTabRect(e.Index)
        Dim FillBrush As New SolidBrush(Color.RoyalBlue)
        Dim TextBrush As New SolidBrush(Color.White)
        Dim sf As New StringFormat
        sf.Alignment = StringAlignment.Center
        sf.LineAlignment = StringAlignment.Center

        'If we are currently painting the Selected TabItem we'll 
        'change the brush colors and inflate the rectangle.
        If CBool(e.State And DrawItemState.Selected) Then
            FillBrush.Color = Color.White
            TextBrush.Color = Color.RoyalBlue
            TabPage1.BackColor = Color.LightBlue  ' change the backcloor of your tabpage1
            TabPage2.BackColor = Color.LightGreen ' Change backcolor of tabpage2
            ItemRect.Inflate(2, 2)
        End If

        'Set up rotation for left and right aligned tabs
        If TabControl1.Alignment = TabAlignment.Left Or TabControl1.Alignment = TabAlignment.Right Then
            Dim RotateAngle As Single = 90
            If TabControl1.Alignment = TabAlignment.Left Then RotateAngle = 270
            Dim cp As New PointF(ItemRect.Left + (ItemRect.Width \ 2), ItemRect.Top + (ItemRect.Height \ 2))
            e.Graphics.TranslateTransform(cp.X, cp.Y)
            e.Graphics.RotateTransform(RotateAngle)
            ItemRect = New Rectangle(-(ItemRect.Height \ 2), -(ItemRect.Width \ 2), ItemRect.Height, ItemRect.Width)
        End If

        'Next we'll paint the TabItem with our Fill Brush
        e.Graphics.FillRectangle(FillBrush, ItemRect)

        'Now draw the text.
        e.Graphics.DrawString(CurrentTab.Text, e.Font, TextBrush, RectangleF.op_Implicit(ItemRect), sf)

        'Reset any Graphics rotation
        e.Graphics.ResetTransform()

        'Finally, we should Dispose of our brushes.
        FillBrush.Dispose()
        TextBrush.Dispose()

    End Sub
Luc001 77 Posting Whiz

Hi,

To let the code that Animal Mother provided work.
You need to change in the properties of that Tabcontrol the Drawmode = OwnerDrawFixed

Luc001 77 Posting Whiz

it works for the final result, but when you click the dropdown button it shows you day and month, I want to pick years only, how can I do that

thanks

Hi,

If you want only a dropdown with years to select without any days and months, then you doesn't need a datetimepicker but only a combobox completed with years.

debasisdas commented: exactly +8
Luc001 77 Posting Whiz

Hi,

If you'll using this Powerpointviewer ActiveXcontrol then it's like any other control in your application.

Luc001 77 Posting Whiz

Hi,

You can find some information, here.

Luc001 77 Posting Whiz

Hi,

To view your powerpoint presentations into your application, without to open Powerpoint Office. You need a Powerpoint Viewer ActiveX control for that.
You can download one, here.
I hope it helps for you.

Luc001 77 Posting Whiz

Hi,

Before I posted this code I've tested it without any other key.
So, When you type "O" the Msgbox will be showing the message.

Luc001 77 Posting Whiz

Hi,

You can find some examples how to create custom buttons, here.

Luc001 77 Posting Whiz

Hi,

You can find the proper version for your needs,here.

Luc001 77 Posting Whiz

Hi,

When you need Crystal Reports then you need Visual Studio Standard or Higher. It doesn't work with express.

Luc001 77 Posting Whiz

Hi,

You could find some info, here.

Luc001 77 Posting Whiz

Hi,

Go to the properties of your button and use this text: &Open and this name: btnOpen
You will see in the designer the text appear in the button like this: Open

Now, try this part of code:

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
        MsgBox("You used the shortcut key")
    End Sub
Luc001 77 Posting Whiz

Hi chibex64,

Your code only shows a randomvalue and not the datetime.minute or datetime.year.
You should do it like this:

'declare variables
        Dim randomvalue As New Random   'create random object
        Dim randomhold As Integer

        'generate random number
        For i As Integer = 0 To 9999
            randomhold = randomvalue.Next(1, 9999)
            txtUserId.Text = randomhold & " " & DateTime.Now.Minute & "  " & DateTime.Now.Year
        Next
Luc001 77 Posting Whiz

Hi,

When you first open up a project written in VS 2008 inside VS 2010 it will normaly prompt you to upgrade the project. What this actually does is update the project (.vbproj) and solution .(sln) files to be compatible with VS 2010.

Did you tryed that?

Luc001 77 Posting Whiz

Hi,

You can find some information, here.

Luc001 77 Posting Whiz

Hi,

You could try to set AutoGenerateColumns = off .

Luc001 77 Posting Whiz

Guys, is there a way to programatically and more efficiently sort records displayed in a datagridview control? If so, how?

Hi,

You should use the Datagridview.Sort method.
You can make your sorting in a ascending or decending direction.

You can find an example, here.

Luc001 77 Posting Whiz

Hi,

You could mark this thread as solved.

Luc001 77 Posting Whiz

Hi,

You can try something like this:

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, _
    RadioButton2.CheckedChanged
        If RadioButton1.Checked Then
            MsgBox("You clicked Radiobutton1")
        End If
        If RadioButton2.Checked Then
            MsgBox("You clicked Radiobutton2")
        End If
    End Sub
Luc001 77 Posting Whiz

Hi,

You need to use the performance counter class for that.
Look, here.

Luc001 77 Posting Whiz

Hi,

If that solved your problem, mark this thread as solved.

Luc001 77 Posting Whiz

Hi,

You can try something like this:

EmailTextBox.Text = EmailGridView.Item(1, DataGridView1.SelectedRows(0).Index).Value
Luc001 77 Posting Whiz

Hi,

Something like this;

Private Sub NameTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NameTextBox.KeyDown
        If e.KeyCode = Keys.Back Then
            MessageBox.Show("You hit the Backkey")
        End If
        If e.KeyCode = Keys.CapsLock Then
            MsgBox("You hit the Capslockkey")
        End If
    End Sub
Luc001 77 Posting Whiz

Hi,

can anyone guide me on how to check the server DateTime when the application launch. i want to make sure the user PC has the same DateTime as server when the user use the application. Reason being is some user may tend to change their DateTime backward and it causes a major confusion when it update in the server database.
Please guide me !

Hi,

I'm not sure about how to help you, but you can find some explanation about serverdatetimes, here.

Luc001 77 Posting Whiz

Hi,

You can find an example, here.
To use this you need to have a VS version that installed the Crystal Report template.

Luc001 77 Posting Whiz

Hi,

You can give the checkboxtext the same text as the listviewheader.

What you can do is the use a Datagridview instead and there you can add checkboxes.

Luc001 77 Posting Whiz

Hi,

You can find some explanation, here.

Luc001 77 Posting Whiz

Hi,

You can't add a Checkbox into the listview header, but you can add a checkbox into the listview header and use this ccde to use it.

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

  For Each lvitem As ListViewItem In Me.ListView1.Items
   If lvitem.Checked = False Then
      lvitem.Checked = True
   Else
      lvitem.Checked = False
   End If
  Next

End Sub
Luc001 77 Posting Whiz

Hi,

Here's an example how to do it:

Private Sub PrintDocument1_BeginPrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs) Handles PrintDocument1.BeginPrint 
    '--- Start printing at the start of the string 
    mStringPos = 0 
  End Sub 

  Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage 
    '--- Setup graphics context 
    Dim fnt As New Font("Arial", 10) 
    e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias 
    '--- Calculate the number of characters that fit inside the margins 
    Dim area As SizeF = New SizeF(e.MarginBounds.Width, e.MarginBounds.Height) 
    Dim lines, chars As Integer 
    e.Graphics.MeasureString(PrintText.Substring(mStringPos), fnt, area, _ 
      StringFormat.GenericTypographic, chars, lines) 
    '--- Print the amount of text that fits inside the margins 
    Dim rc As New RectangleF(e.MarginBounds.Left, e.MarginBounds.Top, e.MarginBounds.Width, e.MarginBounds.Height) 
    e.Graphics.DrawString(PrintText.Substring(mStringPos, chars), fnt, _ 
      Brushes.Black, rc, StringFormat.GenericTypographic) 
    '--- Advance print position by <chars> 
    mStringPos += chars 
    '--- We'll need another page if not all characters got printed 
    e.HasMorePages = mStringPos < PrintText.Length 
    '--- Cleanup 
    fnt.Dispose() 
  End Sub
Luc001 77 Posting Whiz

Hi,

You can find a good tutorial, how to create a Chrystal report with VB 2005, look here.

Luc001 77 Posting Whiz

Hi,

You can delete rows by first selecting the rows and then pressing the Delete key. If you may want to confirm the deletion with the user before deleting them. You can do this with the UserDeletingRow event:

Private Sub DataGridView1_UserDeletingRow( _
       ByVal sender As Object, _
       ByVal e As System.Windows.Forms. _
       DataGridViewRowCancelEventArgs) _
       Handles DataGridView1.UserDeletingRow
        If (Not e.Row.IsNewRow) Then
            Dim response As DialogResult = _
            MessageBox.Show( _
            "Are you sure you want to delete this row?", _
            "Delete row?", _
            MessageBoxButtons.YesNo, _
            MessageBoxIcon.Question, _
            MessageBoxDefaultButton.Button2)
            If (response = DialogResult.No) Then
                e.Cancel = True
            End If
        End If
    End Sub