VIPER5646 25 Junior Poster in Training

I seam to be having the same problem.
I added the the code that NetProgramer suggested but I wasn't successful.
My error is given at the While m_Dr.read

This is My code.

query = "Select * From " & Tabela & " where Model= @Model" & " Order by model asc"

        Dim txtSource As String
        Dim ObjFile As New System.IO.StreamReader("C:\CWDEsign\CWDEsign.txt")
        txtSource = ObjFile.ReadToEnd()
        ObjFile.Close()
        ObjFile.Dispose()

        Dim sourse As String = "Data Source=" & txtSource & ";"
        Dim providr As String = "Provider=Microsoft.ACE.OLEDB.12.0;"
        Dim MYcon = providr & sourse
        Dim con = New OleDb.OleDbConnection(MYcon)
        Dim cmd As New OleDb.OleDbCommand(query, con)
        With cmd.Parameters
            .AddWithValue("@Model", BModel)
        End With
        cmd.CommandType = CommandType.Text
        cmd.CommandText = query
        con.Open()
        Dim m_dr As OleDbDataReader

        m_dr = cmd.ExecuteReader
        m_dt.Load(m_dr)
        If (con.State = ConnectionState.Open) Then
            con.Close()
        End If
        con.Open()
             While m_dr.Read
            ModelBuilder_Relation.Add(m_dr.GetString(0))
                End While
VIPER5646 25 Junior Poster in Training

Hi all I would like to do a Calender with tasks in VB but I can't seam to find a calender that I would be able to choose the size of the Cells.
I was able to use Month Calender but I can not resize it.
If there is such a Calender in VS2010 can some one help me how to get it.

Thanks.

VIPER5646 25 Junior Poster in Training

Thanks rch1231 I'll try that.

VIPER5646 25 Junior Poster in Training

Thanks jakob for your reply.
Yes I have The Home edition. I guess I'll just have to wait until I Upgrade to Windows7
Pro.

VIPER5646 25 Junior Poster in Training

Thanks rch1231 for your reply.
Before I try that does that mean if I have total of lets say 6 users 3 in each XP pc do I need to add those six users on the vista PC?
Or is there a different way to do that.
I do know that in the Server 2003 R2 we can just add the the users of the XP pc to the domain. I was woundering if we could do something like that in Vista. But vista does not seam to have a Domain.

VIPER5646 25 Junior Poster in Training

I currently have two desktops and one laptop in the same workgroup.
The desktops have XP PRO and the laptop has a VISTA OS I am the Administrator on all PCs.
I can see both Xp's when openning the Network on the Vista.
I'm sharing a folder in my vista with the xp's and they are working ok.
My situation is trying to give permitions only to one user on the xp's. I tryed to add \\xp1\user name to the permitions but I can't seam to find any of the XP's in the permition only the vista shows up. How can I give permitions to the that user only.
Thanks[\QUOTE]

VIPER5646 25 Junior Poster in Training

Thanks LUC001
Your code works.

VIPER5646 25 Junior Poster in Training

:?: Hi all
I'm trying to import data from an exel sheet to a data grid but I keep on getting the following error "The Microsoft Jet database engine could not find the object"

Here is my code
Thanks

Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class ExellFrm

    Private Sub ExellFrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim MyConnection As System.Data.OleDb.OleDbConnection
        Dim myPath As String = "C:\Users\John\Desktop\book1.xls"
        Try

            ' importing Data from Excel
            Dim DtSet As System.Data.DataSet
            Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
            MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; data source='" & myPath & " '; " & "Extended Properties=Excel 8.0;")
            MyConnection.Open()
            ' Select the data from Sheet of the workbook.
            MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [test$]", MyConnection)
            DtSet = New System.Data.DataSet
            MyCommand.Fill(DtSet)
            exellgrid.DataSource = DtSet
            MyConnection.Close()
        Catch ex As Exception
            MessageBox.Show("ERROR  " & ex.Message)
        End Try
    End Sub
End Class
VIPER5646 25 Junior Poster in Training

Thanks Adapost
I have solveded it.
I created a Module then I sent the values from form 1 to the Module.
When the 2nd form is open it recals the values from the Module

VIPER5646 25 Junior Poster in Training

thank you for your reply

yes DsgnForm is a name of Form class.

Here is a private sub of form1 named ''CustumerForm'' where i'm trying to send the data to the dsgnform.
hope this helps you help me solve my situation.

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
        Me.NoteGrid.Visible = False
        Try
            If m_CustomerUpdateCell > 0 Then

                DsgnForm.InsertNote = txtCustumerNote.Text
                Mainform.openDEsignForm() 'Mainform is the MDI Parent
            End If

            If (IsNumeric(txtOrderEntry.Text)) And m_CustomerUpdateCell = 0 Then
                SerchOrderentry()
                If response = vbNo Then Exit Sub
                DsgnForm.InsertOE = txtOrderEntry.Text
                MsgBox(DsgnForm.InsertOE)
                DsgnForm.InsertFN = txtFirstName.Text
                DsgnForm.InsertLN = txtLastName.Text
                DsgnForm.InsertAD = TxtAddress.Text
                DsgnForm.InsertCV = txtCivic.Text
                DsgnForm.InsertCTY = txtCity.Text
                DsgnForm.InsertHome = txtHomePhone.Text
                DsgnForm.InsertCell = txtCellPhone.Text
                DsgnForm.InsertFax = txtFax.Text
                DsgnForm.InsertWrk = txtWorkPhone.Text
                DsgnForm.InsertNote = txtCustumerNote.Text

                btnNext.Enabled = False
                Mainform.openDEsignForm()'Mainform is the MDI Parent
                
            ElseIf txtOrderEntry.Text.Length = 0 Then
                MessageBox.Show("The Order Entry can not be Blank", "CW DEsign", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub

            ElseIf Not (IsNumeric(txtOrderEntry.Text)) Then
                MessageBox.Show("The Order Entry must only be Numbers", "CW DEsign", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub
           End If
        Catch ex As Exception
            MessageBox.Show("ERROR  " & ex.Message)
        End Try
    End Sub
VIPER5646 25 Junior Poster in Training

Hi all
I have two forms which are being displayed from the MDI Parent form. In the following code I would like to send data from form 1 to form 2.

DsgnForm.InsertOE = txtOrderEntry.Text
                DsgnForm.InsertFN = txtFirstName.Text
                DsgnForm.InsertLN = txtLastName.Text
                DsgnForm.InsertAD = TxtAddress.Text

My problem is when the second form is opened the variables are empty.
How can I send data to the second form.

Thanks

VIPER5646 25 Junior Poster in Training

Hi
I'm using XP PRO with sp3 and administrative Rights.
When I go to start All Programs>Accessoeries>Ststem tools I get an empty folder. The same with Control Panel Administrative Tools also empty.
When I did a Search I found them in Documents and Settings\Allusers\Start Menu\Programs\Aministrative Tools.
Will I be able to copy these Icons to the Control Panel Aministrative Tools. If so will they work if not how can I restore them to the right place.

Thanks.

VIPER5646 25 Junior Poster in Training

Hi
I have a datagridview which I would like to change the the color of the text in a cell if the number is negative in the Total column.
This is what I have so far.

Dim rowcont As Integer = (TTLGrid.Rows.Count) - 1
        For x = 0 To rowcont
            Dim Total As String = TTLGrid.Rows(x).Cells(4).FormattedValue
            Dim PosNeg As String = Microsoft.VisualBasic.Left(Total, 1)
            If PosNeg = "-" Then
??
            End If

Thank You

VIPER5646 25 Junior Poster in Training

Hi all
I have been straggling to mask a text box.
I searched for the Mask property I could not find it.
I have also tried to use textbox.mask it tells me that mask is not a member.
I'm trying to enter currency in The text box ($1000.000)
I'm using Visual Studio 2010
thank you/QUOTE]

VIPER5646 25 Junior Poster in Training

Thank you all for all of your effort.
your code worked with a text box but not with a Label.
So I changed my label to text box .

VIPER5646 25 Junior Poster in Training

Thanks Yorro your code puts the label in the Center Left.

This is what I'm trying to do I have a Dialog showing the an Order Number,
I'm also using the Opacity to show and Fade the dialog as Outlook displays the warnings.

Tank you

VIPER5646 25 Junior Poster in Training

Thank you all for your replies.
I have tried all but still not successful.
I have tried all the codes with Anchor set to None.
Here is what I have in the Sub, And in front it shows the where the label is being placed. Hope some one can help me figure this out with the following code.

Private Sub Localidade()
        lblnumber.TextAlign = ContentAlignment.MiddleCenter
        Dim x As Integer = (DsgnForm.Width) + 300
        Dim y As Integer = (DsgnForm.Height) + 300
        Me.Location = New Point(x, y)

        lblnumber.SetBounds((Me.ClientSize.Width - lblnumber.Width) / 2, _
                            (Me.ClientSize.Height - lblnumber.Height) / 2, 0, 0, BoundsSpecified.Location) ' (CENTER RIGHT)

        'lblnumber.Top = Me.Height / 2 
        'lblnumber.Left = Me.Width / 2 (BOTTOM RIGHT)

        ' lblnumber.Left = (Me.ClientSize.Width / 2) - (lblnumber.Width / 2) (BOTTOM RIGHT)

        ' lblnumber.Top = (Me.Height / 2) - (Me.Height / 2) 
        ' lblnumber.Left = (Me.Width / 2) - (Me.Width / 2) (TOP LEFT)
    End Sub
VIPER5646 25 Junior Poster in Training

Hi
I need help to center a label with a form.
I have tried with the following code but was unsuccessful.

Me.Width = 135
        Me.Height = 38
        Dim w As Integer = Me.Width / 2
        Dim h As Integer = Me.Height / 2
        Dim lblw As Integer = Me.lblnumber.Width / 2
        Dim lblh As Integer = lblnumber.Height / 2
        Dim ttw As Integer = w - lblw
        Dim tth As Integer = h - lblh
         lblnumber.Location = New Point(ttw, tth)
VIPER5646 25 Junior Poster in Training

I have solved it.
I just needed to create a right click event and add the custnotemenu.show

VIPER5646 25 Junior Poster in Training

Sorry I wrote down the wrong event
this is the correct new event
Thank you Adatapost for your reply
I have added the event handler but still nothing happens.
Could I have the wrong event handler ?

Private Sub Custnotemenu_ItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles Custnotemenu.ItemClicked [/CODE] 
VIPER5646 25 Junior Poster in Training

Thank you Adatapost for your reply
I have added the event handler but still nothing happens.
Could I have the wrong event handler ?

Private Sub NoteGrid_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles NoteGrid.CellContentClick
VIPER5646 25 Junior Poster in Training

HI

I'm trying to use a menu on a datagridview, I have put a Contextmenutrip on the form. When I right click in a cell
I would like a menu to pop up. but nothing happens.
This is the code I have tried.

Private Sub CustomerPopMenu_ItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs)

        Select Case e.ClickedItem.ToString()

            Case "Edit"
                MsgBox("Edit")

            Case "Delete"
                MsgBox("Delete")
        End Select

    End Sub
VIPER5646 25 Junior Poster in Training

Hi I have been trying to flatten the columns header in a Datagrid, the same way as we do it with buttons using .FlatStyle = FlatStyle.Flat but have been unsuccessful.
If it is possible to do it can someone help me.
Thank you

VIPER5646 25 Junior Poster in Training

Thank you adatapost
for your help

VIPER5646 25 Junior Poster in Training

Hi
I have a Datagrid with column(1) showing the date.
The dates are being Displayed as 01-13-2009 (mm-dd-yy).
That's how it is saved in the DB.
I wouls like it to be displayed in the Datagrid in the following format
Jan-13-2009.
Can anyone help?

Thank you

VIPER5646 25 Junior Poster in Training

Thank you adatapost for your reply
Can you explain.
I'm new at this. This is my first app.

VIPER5646 25 Junior Poster in Training
Dim DesinNum As DataColumn = New DataColumn
            With DesinNum
                .ColumnName = "DEsign#"
                .Expression = "ISNULL(usrini,'')+design+typcde"
            End With

            With Design_dt.Columns
                .Add(DesinNum)
            End With

These are the results I'm getting
usrini="J", Design=123,typcde=cst expression=j123cst
usrini="J", Design=123,typcde="" expression=""


I have this code to add a new colum in the datagrid.
It seams to work ok except when the typcde is blank the design# is blank.
I'm using this on vb2008
can anyone help me with this expression?

VIPER5646 25 Junior Poster in Training

thank you

VIPER5646 25 Junior Poster in Training

Hi
I need to create an exec File.
I believe I need to use deploy. But I can't find the command.
thanks in advance

VIPER5646 25 Junior Poster in Training

HI

These are the forms I Have Log in,Customer,Order. They are opened In this order.
At start up the Log in Form assigns the User in The Order Form and all works fine. But when I close the Order Form I loose the user.
I would like to maintain the user available until the app. is closed.

This is the coed I used in Log in Form.

OrderForm.Userini=txtUser.Text

Thanks

VIPER5646 25 Junior Poster in Training

thanks all for your help.
I have a solution for my Issue.

In form1 I have the following code.

Form2.myParentForm = Me
            Form2.Show()

and in form2 this

Public myParentForm As Form
Me.Close()
            If (Me.myParentForm IsNot Nothing) Then
                Me.myParentForm.Close()
            End If
VIPER5646 25 Junior Poster in Training

Thank you for your replies but it still isn't solved.
To Zandermander your code worked but it closes the entire appl. and I only want form1 and 2 to close.
To Samir_Ibrahim yes I have tried your coed and it did not work.
It closes only form1 but it does not close form2

VIPER5646 25 Junior Poster in Training

I have tried your code but I'm still unsuccessful. Still can't close form1. form2 closes but not form1.
When I click the Close button it jumps to the closing sub (your code)
but does not close form 1.
Help

VIPER5646 25 Junior Poster in Training

Thanks Jireh and samir_ibrahim for your replies.
The first Issue has been solved.
I still need more help with the second Issue.
This is the coed I used to open form1.

For Each Form In Me.MdiChildren
            Form.Close()
        Next
        Dim CustomerMDIChild As New CustumerRprt()
        CustomerMDIChild.MdiParent = Me
        CustomerMDIChild.Show()

This coed opens form2.

Design_Report.Show()

How can I close form2 and form1 by just closing form2

VIPER5646 25 Junior Poster in Training

I have two Issue using a MDI app.
1-at this moment I'm able to open MDI child forms using the MDIparent
except when the I opens form1 I'm also able to open forms 2
and 3 .
but I only want one form to be open at a time.
2- The next issue is I have form 2 to be opened from form1 and I would like to close form2 and form1 when click close on form2. At this moment I have to close form2 then click close on form1.

Thank you
code for Q1 This is the code on the MDIparent to open the forms.

Public Sub tbbCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbbCustomer.Click
        Dim CustomerMDIChild As New CustumerRprt()
        CustomerMDIChild.MdiParent = Me
        CustomerMDIChild.Show()
        CustomerMDIChild.Location = New Point(Me.Width / 2 - CustomerMDIChild.Width / 2, Me.Height / 2 - CustomerMDIChild.Height / 2)
    End Sub

Q2 here is he code I tried to close form2 and form1.

Public Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click

        If m_ID = 0 Then
            Me.Close()
        Else
            CustumerRprt.Close()
            Me.Close()
        End If
    End Sub
VIPER5646 25 Junior Poster in Training

Thank you all for your help .
qveen72's works great.

VIPER5646 25 Junior Poster in Training

yes it does but I have to double click and I want it to do it just with a single click.
can you help?
thanks

VIPER5646 25 Junior Poster in Training

Hi

I have a checklist box and I am trying to Check and Uncheck the the Items with a single click.
My code seams to be checking and uncheking if the Item is not selected.
If I Click on an Item that is checked it will uncheck it or vice versa, but if I click on that same Item to check it again it won't.
Here is the coed.

Private Sub chklstBuilder_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chklstBuilder.Click
        Dim I As Integer = chklstBuilder.SelectedIndex()

        If (chklstBuilder.GetItemCheckState(I)) = CheckState.Checked Then
            chklstBuilder.SetItemCheckState(I, CheckState.Unchecked)
            Exit Sub
        End If

        If (chklstBuilder.GetItemCheckState(I)) = CheckState.Unchecked Then
            chklstBuilder.SetItemCheckState(I, CheckState.Checked)
        End If
    End Sub

thank you

VIPER5646 25 Junior Poster in Training

Thank you c0deFr3aK
I have tried your coed and it worked
tanks again

VIPER5646 25 Junior Poster in Training

Thank you Teme64 for your reply.
The error I get is "Data type mismatch in criteria expression"
The values being entered is CustID =Integer,username = text,CmbBuilder=Text,cmbModel=test,cmbType=text.
The values being accepted by access db are CustID =Number,
username =Number,CmbBuilder=Text,cmbModel=test cmbType=number.
The way I have my db set is User,cmbbuilder,cmbmodel,cmbtype they are all combo boxes that are extracted for individual tables
the reason for this was because when I design this db I didn't Even dreamed of using visual basic. and I already have 8 months of data in it.
I hope you can help me.
THANKS AGAIN.

VIPER5646 25 Junior Poster in Training

Hi I have an INSERT INTO SQL that keeps on retuning an Syntax error in Insert Into. I cant seam to see where the error is, can anyone Help.
This is my SQL.

Dim DesignSQL As String = "INSERT INTO Design_tbl (CustmrID,[User],Builder,Model,Type) values ('" & _
                    CustID & "', '" & username & "', '" & CmbBuilder.Text & "', '" & _
                    cmbModel.Text & "','" & cmbType.Text & "') "

Thanks

VIPER5646 25 Junior Poster in Training

Hi

Is it possible to use Where in a Rowfilter statement.
If it is can You please show me how.

Thank you

VIPER5646 25 Junior Poster in Training

thank you for your quick reply.
I am hoping I can use the connection rather than using the drag and drop. This is my first app. and would also be a way to learn how it is done.
If any one knows how to do it using this connection can you please reply .
thank you.

VIPER5646 25 Junior Poster in Training

Hi all
I am using Vb2008 Express and an Access DB.
I would like to Display a note from a column in the Notes_tbl to a text box this from an Access database.
Here is the code that I used but it does not do the job.

Dim mycon As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\DEsign.accdb"
        Dim Notes As String = "SELECT * FROM Notes_tbl "
        Dim conNotes As New OleDb.OleDbConnection(mycon)
        Dim Notescmd As New OleDb.OleDbCommand(Notes, conNotes)

        conNotes.Open()

        Dim ID As String = CStr(e.RowIndex)
        Dim qry As String = "SELECT Dsgntxt FROM Notes_tbl where dsgnid ="
        Notescmd.CommandType = CommandType.Text
        Notescmd.CommandText = qry & ID
        m_Notes = Notescmd.ExecuteReader()

        While m_Notes.Read
         txtNotes.Text = (m_Notes.GetString(1))
        End While
VIPER5646 25 Junior Poster in Training

Hi

I'm using Visual Basic Express
When trying to sort columns in DataGridView by using ListSortDirection, I get the not defined error.
I searched Google for app. using ListSortDirection, none of them have to declare it.
Can any one help me.
Thanks

VIPER5646 25 Junior Poster in Training

I do not understand what you mean by " required arguments" being set to yes.
Or can u clarify what I should set to YES.
Thanks

VIPER5646 25 Junior Poster in Training

I had tried that .
This might help you help me solve this problem.
My Customer_tbl is built of ID,Date,PO Number,First Name,Last Name, Address,Civic,City,Home Phone,Mobile Phone,Fax Number.
THE ID is auto Number and is linked to another table,Date --Date/Time, PO Number--Number, the rest is all text.
I'm just wondering if I have to enter every field in my app.
Thanks again

VIPER5646 25 Junior Poster in Training

Now I seam to get a diferent error.
Which tells me that it canot find the "First Name ".
I went to the table and copy and paste it in the sql.
I still get the error.
Can you help me?

VIPER5646 25 Junior Poster in Training

HI v5prgrmr Dim mysql As String = "insert into Customer_tbl values('First Name','Last Name') values ('John','Unknown');"

[TEX]Now I seam to get a diferent error.
Which tells me that it canot find the "First Name ".
I went to the table and copy and paste it in the sql.
I still get the error.
Can you help me ?[/TEX]

VIPER5646 25 Junior Poster in Training

Hi Debasisdas
TEX]If I understood your question my Con is posted.
If you see my coed that is my CON.[/TEX]