VIPER5646 25 Junior Poster in Training

I solved.
Instead of using add I used Insert, to insert the empty row.

VIPER5646 25 Junior Poster in Training

Hello all
I have a form with two datagridviews.
Grid A is polulated with orders from DB, grib B has an empty table with the same column name as grid A.
Im currently draging orders from Grid A onto grid B.
My isue is that since grid B has only one empty row, it only alows to drag one item.
What I want to accomplish is to add an empty row in grid B In index 0 (the firsst row)
In the dragdrop event I tried to add an empty row, but this code inserts an empty row before the firtst row that was added

Private Sub DGV_Pulled_DragDrop(sender As Object, e As DragEventArgs) Handles DGV_Pulled.DragDrop Dim RowsSource As Integer = Convert.ToInt32(e.Data.GetData(Type.GetType("System.Int32"))) Dim clientPoint As Point = Me.DGV_Pulled.PointToClient(New Point(e.X, e.Y)) Dim hit As DataGridView.HitTestInfo = Me.DGV_Pulled.HitTest(clientPoint.X, clientPoint.Y) If hit.Type = DataGridViewHitTestType.Cell Then DGV_Pulled.Rows(hit.RowIndex).Cells(hit.ColumnIndex).Value = DGV_Orders.Rows(RowsSource).Cells("oe").Value DGV_Pulled.Rows(hit.RowIndex).Cells(hit.ColumnIndex + 1).Value = DGV_Orders.Rows(RowsSource).Cells("Address").Value Dim order As String = DGV_Orders.Rows(RowsSource).Cells("OE").Value End If Dim row As New DataGridViewRow With row .CreateCells(DGV_Pulled) .Cells(0).Value = DBNull.Value End With Me.DGV_Pulled.Rows.Add(row) End Sub

VIPER5646 25 Junior Poster in Training

Thanks rproffitt
after removing sp21 and updated the references the reports from both apps work fine.

rproffitt commented: Thank you for the update. Sorry if I was unclear but this bit us over a decade ago. +15
VIPER5646 25 Junior Poster in Training

Thanks rproffitt for your reply.
What do you mean by old memory.
If By recompliling you mean rebuild/ republish it, it didn't work the problem still precistes.

VIPER5646 25 Junior Poster in Training

Hello
I have created awhile ago in VS2017 an application [application A] with CR sp21 which works fine.
Now Ihave another application [application B] created in vs2019 with CR sp29.
When I install app B on the same pc where App A is installed the CR wont work so I installed CR runtime sp29 and app B works, but app A returns an error see attach.
How can I have both app working.

S_image.png

VIPER5646 25 Junior Poster in Training

Got it working.
Added the calender control to a new form and the references were added automaticly.

VIPER5646 25 Junior Poster in Training

Hi all
I Have a CalendarvProject with a 3rd party Calendar control.
the application was working fine untill I upgraded the Calendar Control .
When I opened the solution two references were no longer availabe, so I had errors.
One of the references was ExtremeCalenderControl the other AxXtremeCalendarControl.
I was able to find the ExtremeCalenderControl but can't seem to find ExtremeCalenderControl.
I contacted support for the Calender Control but they said they weren't responsible with what Microsoft does.
So I need help to where can I find this reference.
Thank you in advance.

VIPER5646 25 Junior Poster in Training

Hi all
I have a datagridview with 2 columns.
fist column is Datagridview combobox the second is a datagridtextbox.
I'm trying to fill the second column based on the combobox selection .
The Method that captures the selected item does not track which row is being edited.
I have tried using the Mouse up and Cell edit events but they were unsuccessful.
This is the code that I use to capture which item has been selected.

Private Sub DGV_LinesItem_EditingControlShowing(ByVal sender As System.Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles DGV_LinesItem.EditingControlShowing
        Dim editingComboBox As ComboBox = e.Control
        AddHandler editingComboBox.SelectedIndexChanged, AddressOf Me.editingComboBox_SelectedIndexChanged
    End Sub
    Private Sub editingComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        If IsNumeric(CType(sender, ComboBox).SelectedValue) Then
            Me.Selecteditem = CType(sender, ComboBox).SelectedIndex
        End If
    End Sub
VIPER5646 25 Junior Poster in Training

I hve Solved it by replacing loop with While Do

FUNCTION `Calculater`(intrval int, req date) RETURNS date
    DETERMINISTIC
BEGIN
declare calculated date;
declare added int default  0;

WHILE added <intrval do
set calculated = DATE_SUB(req,interval 1 day);
set req=calculated;
IF weekday(calculated)<5  then
set added= added+1;
End If;
end while;
RETURN calculated;
END
VIPER5646 25 Junior Poster in Training

Hello all.
I have a funtion in MYSQL to substruct days from a date.
This function seamsto work but some dates it times out.
This is my function

CREATE DEFINER=`root`@`localhost` FUNCTION `Calculater`(intrval int, req date) RETURNS date
    DETERMINISTIC
BEGIN
declare calculated date;
declare added int default  0;

Lbl_Loop: Loop
IF added=intrval then
leave lbl_loop;
End IF;
set calculated = DATE_SUB(req,interval 1 day);
IF weekday(calculated)<5  then
set added= added+1;
End If;
end loop;
RETURN calculated;
END

If I do select Calculater(1,"2020-02-04"); it works, but select Calculater(1,"2020-02-02"); it runs for a few seconds and My SQL times out.

Thanks in advance.

VIPER5646 25 Junior Poster in Training

This application was sending out orders without errors when smtp wasn't secured.
Now the clients webmail server was changed to ssl.
After making the changes the server times out.
I did some research and found this .ConnectType = SmtpConnectType.ConnectSSLAuto
I'm anable to assign the SmtpServer.ConnectType = SmtpConnectType.ConnectSSLAuto.

This is my code.

Dim SmtpServer As New SmtpClient()
        Dim mail As New MailMessage()
            SmtpServer.UseDefaultCredentials = False
            SmtpServer.Credentials = New Net.NetworkCredential(jonDoe@Domain.com, srvPass)
            SmtpServer.Port = 465
            SmtpServer.Host = mail.Domain.com
            SmtpServer.EnableSsl = true
            mail = New MailMessage With {.From = New MailAddress(frome)
        }
            mail.To.Add(Too)
            mail.Subject = Subject
            mail.Body = InputBox("Enter the body here", "Body")
            For Each Row In attch_tbl.Rows
                OE_File = Row("OE").ToString.TrimStart("0c")
                OE_File = "*" & OE_File & "*"
                For Each foundFile As String In My.Computer.FileSystem.GetFiles("N:\",
        Microsoft.VisualBasic.FileIO.SearchOption.SearchTopLevelOnly, OE_File)
                    If foundFile <> "" Then
                        mail.Attachments.Add(New Attachment(foundFile))
                        FileNum = FileNum + 1
                    End If
                Next
            Next
            If FileNum >0 Then
                SmtpServer.Send(mail)
               end if
VIPER5646 25 Junior Poster in Training

Thank you all for your assistance.
I solved it by installing the 2016 redistribute.

VIPER5646 25 Junior Poster in Training

Sorry missed the code

        Dim dbcon As OdbcConnection
        Dim cmd As OdbcCommand
        Dim dr As OdbcDataReader
        Dim SelectString As String
        dt = New DataTable
        cmd = New OdbcCommand
        SelectString = "Select * FROM Fees"
        Try
            dbcon = New OdbcConnection("DSN=AUS")
            dbcon.Open()
            With cmd
                .CommandType = CommandType.Text
                .CommandText = SelectString
                .Connection = dbcon
                dr = .ExecuteReader
                dt.Load(dr)
            End With
VIPER5646 25 Junior Poster in Training

Hi all
I have a x32 bit application on a windows10 x64 machine.
The application was working fine untill I change the connection string from OLEDB to ODBC with a DSN.
Since my application x32 bit I created a x32 bit DSN to an ACCESS db wich also is a x32 (Office 365).
When I run the application I receive the error, cannot open database (Unknown) it may not be a database that your application recognizes.
I can oppen the Database from Access fine no pronblem, I also recreated the 32bit DSN dultiple times and the problem still precistes.

VIPER5646 25 Junior Poster in Training

Thanks Tinstaaf
I Solved by adding Time.
For Example if its an AM install the start would be 7:00 am and compleate would be noon. This way I can alwas search for available installers the same way I was using for full days, accept of using the date I will use date and time.

VIPER5646 25 Junior Poster in Training

The Database currently has a column with the day an install is scheduled and another with the number of days and if it is am or pm install.
this is the format of the number of days column it is a mask field AM-PM-#days_.

VIPER5646 25 Junior Poster in Training

thanks
but I can't refactor the database because I didn't created it.
It belongs to another program.

VIPER5646 25 Junior Poster in Training

Hi
I Currently working on a project to schedule installers to do installations.
When scheduling the user will select the day of intall and if the number of days the instalation will take or motning or afternoon if its only hafday and I want the application to search which installer is available for that specific day or halfday
I currently have it working with full day install. I need help on how to find if an nstaller is available for a half day (morning or afternoon).
This is how i'm searching for full day.
Thanks

  Private Sub Available_instalers()
        Dim Available_instalers = New DataTable
        Dim installer_nme As String
        Dim available As Boolean = True
        Dim dte_current As Date = CDate(val_from.Date.ToString("MMM/dd/yy"))
        Dim dte_inst_From, dte_inst_To As Date
        Dim st_inst_from, st_inst_to As String
        Dim dr As DataRow
        Try
            With Available_instalers
                .Columns.Add("Installer", GetType(System.String))
            End With
            dv_installer_Schedule = New DataView(dt_installer_Schedule)
            'This loops through every installer and checks who is avalable for the selected day
            For Each inRow In ds_Installer.Tables("Installer").Rows
                dte_current = CDate(val_from.Date.ToString("MMM/dd/yy"))
                available = True
                installer_nme = inRow("ins_Name").ToString
                If UCase(installer_nme) = "LUIS" Or UCase(installer_nme) = "STEPHAN" Then
                    dv_installer_Schedule.RowFilter = "(Installer ='" & installer_nme & "' OR Installer='L&S')  AND insFrom >'" & Today() & "'"
                Else
                    dv_installer_Schedule.RowFilter = "Installer='" & installer_nme & "' AND insFrom >'" & Today() & "'"
                End If

                dv_installer_Schedule.Sort = "insFrom asc"
  'This loops each day to find if the installer is available
                Do While dte_current <= Val_to
                    For Each schInstall In dv_installer_Schedule.ToTable.Rows
                        st_inst_from = schInstall("insFrom").ToString …
VIPER5646 25 Junior Poster in Training

Thanks XRJ
This works great and easear to debug when needed .
I just had to change the extradays to this IIf(Not Extra_Days, 1, 0) and fill in the other NAction values

VIPER5646 25 Junior Poster in Training

Hope this makes since. table.JPG

VIPER5646 25 Junior Poster in Training

Hi
I have a datagridview with 9 Processes each process holds dates for stating and compleating a job.
When a process is Late a cell back color is set to yellow, when today is the day the same date on the cell the date gets bolded,if the date is altered by the admin the dates forecolor is red and when is compleated a date gets crossed out.
My Problem is some cells on one process have fore color is white when its set to red.

This is my code.

  Private Sub Dgv_Formate(ByVal e As DataGridViewCellFormattingEventArgs, ByVal Stat As String, ByVal processDate As Date, ByVal Extra_Days As Boolean)
        Dim Style As Font = Me.DGV_Machining.DefaultCellStyle.Font
        Dim thisdate As Date = "#12/09/2016#" 'Today()
        Dim started As New Proces
        If Me.DGV_Machining.Rows(e.RowIndex).Cells(Stat).FormattedValue = "n" And Not Extra_Days Then
            If processDate < thisdate Then
                e.CellStyle.BackColor = Color.Yellow
            ElseIf processDate = thisdate Then
                e.CellStyle.Font = New Font(Style, FontStyle.Bold)
            End If
        ElseIf Me.DGV_Machining.Rows(e.RowIndex).Cells(Stat).FormattedValue = "n" And Extra_Days Then
            If processDate < thisdate Then
                e.CellStyle.BackColor = Color.Yellow
                e.CellStyle.Font = New Font(Style, FontStyle.Italic)
                e.CellStyle.ForeColor = Color.Red
            ElseIf processDate = thisdate Then
                e.CellStyle.Font = New Font(Me.Font, FontStyle.Italic + FontStyle.Bold)
                e.CellStyle.ForeColor = Color.Red
            Else
                e.CellStyle.BackColor = Color.White
                e.CellStyle.Font = New Font(Style, FontStyle.Italic)
                e.CellStyle.ForeColor = Color.Red
            End If
        ElseIf Me.DGV_Machining.Rows(e.RowIndex).Cells(Stat).FormattedValue = "y" And Not Extra_Days Then
            e.CellStyle.BackColor = Color.White
            e.CellStyle.Font = New Font(Style, FontStyle.Strikeout)
            e.CellStyle.ForeColor = Color.Black
        ElseIf Me.DGV_Machining.Rows(e.RowIndex).Cells(Stat).FormattedValue = "y" And Extra_Days Then
            e.CellStyle.ForeColor = Color.Red
            e.CellStyle.BackColor = Color.White
            e.CellStyle.Font = New Font(Me.Font, FontStyle.Italic + FontStyle.Strikeout)
        End If …
VIPER5646 25 Junior Poster in Training

Found a Solution for the error.
all I had to do was change the following from integer to decimal.
.cab1 = G.Sum(Function(inpro) inpro.Field(Of Decimal)("CabCat1")),
.cab2 = G.Sum(Function(inpro) inpro.Field(Of Decimal)("CabCat2"))

VIPER5646 25 Junior Poster in Training

It's in this Line
.cab1 = G.Sum(Function(inpro) inpro.Field(Of Integer)("CabCat1")),

VIPER5646 25 Junior Poster in Training

Hi all
I'm new using LinQ.
Im having Specified Cast not Valid in this Function.
Hope someone let me know what I'm doing wrong.
this is the Function

Private Function GroupedBy() As DataTable
        Dim Sales As New ds_Sales_OELI
        Dim dt As DataTable = Sales.Not_SCheduled
        GroupedBy = New DataTable
        Dim dr As DataRow
        With GroupedBy
            .Columns.Add("ProDate", GetType(String))
            .Columns.Add("ttlCabs", GetType(Integer))
        End With
        Dim ReadyProduction As IEnumerable(Of DataRow) = dt.AsEnumerable
        Try
            Dim QUERY =
                From InPro In dt.AsEnumerable
                Group InPro By production = InPro.Field(Of String)("inProduction") Into G = Group
                Select New With
                    {
                    .category = production,
                  .cab1 = G.Sum(Function(inpro) inpro.Field(Of Integer)("CabCat1")),
              .cab2 = G.Sum(Function(inpro) inpro.Field(Of Integer)("CabCat2"))
            }
            For Each InPro In QUERY
                dr = GroupedBy.NewRow
                With GroupedBy
                    dr.Item("ProDate") = InPro.category
                    dr.Item("ttlCabs") = InPro.cab1 + InPro.cab2
                End With
            Next
        Catch ex As Exception
            MsgBox(Me.Text & " GroupedBy " & ex.Message)
        End Try
    End Function
VIPER5646 25 Junior Poster in Training

Hi I'm having an 'The application is in Break Mode Error' when debuging this sort code.

  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim ds As New test1
        Dim reportdoc As New CrystalReport1
        ds.Tables.Add(Test_tbl)
        DataGridView1.DataSource = ds.Tables("Datatable1")
            reportdoc.SetDataSource(ds.Tables("Datatable1"))
        With CrystalReportViewer1
            .ReportSource = reportdoc
            .Refresh()
        End With
    End Sub

The error occurs in this Line 'reportdoc.SetDataSource(ds.Tables("Datatable1"))'

VIPER5646 25 Junior Poster in Training

thanks rproffitt
the links helped.
Here is my new format

lblCustDate.Text = Now().ToString("MMM-dd-yy")
rproffitt commented: Good move IMO. Avoid using language keywords as your own. Some may disagree. +10
VIPER5646 25 Junior Poster in Training

Hi I have an app that I compleated about 2 years ago with vs2010 and all is working.
Now I just oppened the app in vs to make some additions and the error 'Format' is a type and cannot be used as an expression is all over the entire app in lines similar to these ones in the format function.

 lblCustDate.Text = Format$(Now, "MMM-dd-yy")
 lblDesignEditDate.Text = Format$(Now, "MMM-dd-yy")
VIPER5646 25 Junior Poster in Training

this is what I did
I Added a second datagrid just for a test but left the first one.
Now I have dgvShipping and datagrid2. I placed the exact code that I posted previously in datagrid2.CellFormatting and I don't receive the Exception it worked.
Than I went and deleted the first datagrid and changed the code to reference datagrid2 inlieu of dgvShipping again I received the error. So now I have it working with two datgrids.
By this outcome I hope someone has a solution so that I dont have to use 2 datagids.

VIPER5646 25 Junior Poster in Training

Thanks tinstaafl for your reply but that is not it I still get the error.

VIPER5646 25 Junior Poster in Training

Why am I getting a System.StackOverflowException when assingning a value to avariable.
I have used the same process on other forms in this project and they work fine, don't know why this is happening.
This is the error "An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll"
the exception hapens on this line link = Me.dgvShipping.Rows(e.RowIndex).Cells("Link").FormattedValue

    Private Sub dgvShipping_CellFormat(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles dgvShipping.CellFormatting
        Dim columname As String = Me.dgvShipping.Columns(e.ColumnIndex).Name
        Dim link As String = ""
        Try
            If Not IsDBNull(e.Value) Then
                link = Me.dgvShipping.Rows(e.RowIndex).Cells("Link").FormattedValue
                Select Case columname
                    Case "Address"
                        If Me.dgvShipping.Rows(e.RowIndex).Cells("Reschedule").FormattedValue Then
                            e.CellStyle.BackColor = Color.Yellow
                        End If
                End Select
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
VIPER5646 25 Junior Poster in Training

I changed it after the first post.

VIPER5646 25 Junior Poster in Training

Here is the Configuration_Method.

 Private Sub dgv_Config()
        Try
            With Me.dgv_Custom
                .AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
                .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .DefaultCellStyle.Font = New Font("Microsoft Sans Serif", 10, FontStyle.Regular)
                .RowHeadersWidth = 30
                .Columns("Due Date < 4 Weeks").Width = 65
                .Columns("Due Date < 4 Weeks").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Room").Width = 200
                .Columns("OE#").Width = 75
                .Columns("OE#").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Colour").Width = 125
                .Columns("Colour").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("FloorPlan Issue#").Width = 75
                .Columns("FloorPlan Issue#").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Order Status").Width = 55
                .Columns("Order Status").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Order Form").Width = 75
                .Columns("Order Form").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Custom Retail").Width = 75
                .Columns("Custom Retail").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Custom Parts Category").Width = 75
                .Columns("Custom Parts Category").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Number of Custom Parts").Width = 75
                .Columns("Number of Custom Parts").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("P8 Custom Parts Start").Width = 85
                .Columns("P8 Custom Parts Start").DefaultCellStyle.Format = "MMM-dd-yy"
                .Columns("P8 Custom Parts Start").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("P7 Custom Parts Due").Width = 85
                .Columns("P7 Custom Parts Due").DefaultCellStyle.Format = "MMM-dd-yy"
                .Columns("P7 Custom Parts Due").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("P9 Finished Parts Start").Width = 85
                .Columns("P9 Finished Parts Start").DefaultCellStyle.Format = "MMM-dd-yy"
                .Columns("P9 Finished Parts Start").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("P10 Finished Parts Due").Width = 85
                .Columns("P10 Finished Parts Due").DefaultCellStyle.Format = "MMM-dd-yy"
                .Columns("P10 Finished Parts Due").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Link").Visible = False
                .Columns("P8_stat").Visible = False
                .Columns("P7_Stat").Visible = False
                .Columns("P9_stat").Visible = False
                .Columns("P10_Stat").Visible = False
                .Columns("Rescheduled").Visible = False
                .Columns("Required").Visible = False
            End With
        Catch ex As Exception
            MsgBox(Me.Name & ".dgv_Config" & ex.Message)
        End Try

    End Sub
VIPER5646 25 Junior Poster in Training

Thanks for your reply but it didn't work.

VIPER5646 25 Junior Poster in Training

Hi All
I have a method to configure a datagridview, meaning changing the column widths, format columns etc.
If I call the configuration meathod from the form load doesn't work because the form hasn't been totaly loaded and I dont get the correct size of the datagrid, to be able to adjust the clomns with.
How can I performed this.

Private Sub Custom_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        dgv_Custom.DataSource = dt_Custom
        Config_Datagrid()
    End Sub
VIPER5646 25 Junior Poster in Training

I Have Solved by using the Left and Right Functions to separate the left and right of the value.
Here is a code Snipid how I did for future Users.

  RightSide = Right(wbook.Mask.Trim, 36)
  LeftSide = Left(wbook.Mask.Trim, 27)
  UpdateValue = LeftSide & Value & RightSide

RightSide would equal Start
LeftSide equals Compleate
UpdateValue equals Starty Compleate_

VIPER5646 25 Junior Poster in Training

Hi all
I have a table with a Masked column.
How can I INSERT or UPDATE data into the masked column at run Time with out Loading the column into a textbox.
The column is as Folows

ID      Process
1    StartY CompleatY
2    Start_ Compleat_

Thanks in advance.

VIPER5646 25 Junior Poster in Training

Thanks Otep for reply!
Now with that change I receive this error "Column '' does not belong to table finishrelation_qry"

VIPER5646 25 Junior Poster in Training

No this is being pulled from one View.
I have tried populating the dataSet at runtime the datagridview.datasourse=the dataset and all data seams to be good.
But I get he error "Column '' does not belong to table finishrelation_qry"
at this line objRpt.SetDataSource("ds.finishrelation_qry")
Here is the Code

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim DB As New Connection
        Try
            Dim ds As New ds_Rel
            Dim dt As New DataTable
            Dim adapter As New OleDbDataAdapter
            Dim objRpt As New crReport
            Dim cmd As New OleDb.OleDbCommand
            Dim SelectString As String = "Select Species_Name,Door,Name,Line From finishrelation_qry"
            DB.FilePath = "C:\Estimating\DBServerConnection access.txt"
            DB.Password = ""

            DB.connect()
            DB.con.Open()
            With cmd
                .CommandType = CommandType.Text
                .CommandText = SelectString
                .Connection = DB.con
                adapter = New OleDbDataAdapter(cmd)
                adapter.Fill(ds, "finishrelation_qry")

            End With
             DataGridView1.DataSource = ds.finishrelation_qry
            objRpt = New crReport
            objRpt.SetDataSource("ds.finishrelation_qry")
            CrystalReportViewer1.ReportSource = objRpt
            CrystalReportViewer1.Refresh()

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        DB.con.Close()

    End Sub
VIPER5646 25 Junior Poster in Training

I did use the CrystalReport Wizard, but instead of connecting directly to the data base I connected to the dataset.

VIPER5646 25 Junior Poster in Training

Hi all
I just started using Crystal reports in vs2010.
I have created a Dataset in the Designer and pulled data from an access DB.
The dataset is being populated fine.
My Issue is when I assign the dataset to crystal database expert and drag the columns to the report no data was displayed.
So intead applying multiple columns to CR I only assigned one and this column displays data, but the data is wrong it displays colors and I don't have any table with colors in my DB.
I'm wondering if I need to change any settings to have CR working on VS2010 assuming it's free to use.
Thanks in advance.

VIPER5646 25 Junior Poster in Training

Thanks again For your help!
I have solded it.
The issue was that one the column names I had in Cal1 That I was doing the calculating was the same column name as one of the tables and some of the cells had the value of 0.
It seamed like that when theprogram was reading the query actuly was using the info that was in the table instead of doing the calculation.
Buy changing the column name in the query all was solded.
Hope this makes since.

VIPER5646 25 Junior Poster in Training

Thanks rch1231 for your reply!
I have substituted the null Values for 0 but still have the same issue .

VIPER5646 25 Junior Poster in Training

Hi all
I Have 3 Queries in access 2 of them are being used as a calculator we willcalled them Cal1 and cal2. The third query The Order query displays the Customer , the orders and totals which consistes of cal1+cal2 (there is a possibilyty of some cells for cal1 or cal2 beinging blank) .
The results of all 3 queries are good.
My Issue is when I read the data from vb.net using oledbreader some of the cells in the total column are null when there is a value in cal1 and not cal2 (ex: 2+0=Null).
Bein 3 queries I did not post them but if you require the or just one of the let me know.
By the way all of my nimeric values are Decimal values.
Hope somw one can help Thanks

VIPER5646 25 Junior Poster in Training

Thanks for your help.
here is the code that works.

Me.DataGridView1.Rows(Me.DataGridView1.Rows.Count - 1).Cells(0).Style.Alignment = DataGridViewContentAlignment.BottomRight
VIPER5646 25 Junior Poster in Training

Hi all
I have a DataGridView with 2 Columns an Order column (text) and a price Column (decimal)
The Datagrid contains all the orders and price for a certain customer.
I'm currently adding all the prices and adding a new row to the datatable containing the total.In this row on the orders column it has the word "Total" and the Price column the calculated total. It all seams too be working fine.
Since the order column is wide and left align when the word "Total" is added it is to far from the calculated total.
What I need help is how to make the last row of the orders column right align so the word total will be closer to the calculated total While maintaining the remaining rows Left align..

Thanks in advance.

VIPER5646 25 Junior Poster in Training

For future reference.
Controls placed on the surface of an MdiForm show up in front of child forms by default.
Click Here

VIPER5646 25 Junior Poster in Training

Hi all
I Currently have a MDI Form that contains a DataGridView.
When I open a dialog form as a MDi MdiChildren the dialog form partionly hides behing the Datagridview. (I also tried with a windows form same thing happens).
Can any one help me solve this with out having to move the datagrid to a different form.
Here is the Code that I use to open the form.

 Private Sub btnRoom_Click(sender As System.Object, e As System.EventArgs) Handles btnRoom.Click
        Dim frm As Form
        Dim opn As Boolean
        For Each frm In Me.MdiChildren
            If TypeOf frm Is dlgRoom Then
                opn = True
            End If
        Next
        If Not opn Then
            Dim room As New dlgRoom
            room.MdiParent = Me
            room.Show()
        End If
    End Sub

Thanks in Advance.

VIPER5646 25 Junior Poster in Training

Thanks Begginnerdev for your reply.
But by putting the

 With dtOrder.Columns
         .Add(fractColumn)
        End With

Inside of the for next loop I getan Error "Column "xttl" already belongs to this datatale "
But it works Using this Code

 Private Sub ConvertDecimal2Fraction()
            Dim val As Decimal
            dtOrder.Columns.Add(New DataColumn("Total", GetType(String)))
            For i = 0 To dtOrder.Rows.Count - 1
                If IsNumeric((dtOrder.Rows(i)(3).ToString)) Then
                    val = CDec(dtOrder.Rows(i)(3).ToString)
                    dtOrder.Rows.Add()
                    dtOrder.Rows(i).Item("Total") = ((dlgNewTop.Dec2Frac(val, 16)))
                End If
            Next
            dtOrder.Columns(dtOrder.Columns.Count - 1).SetOrdinal(3)
        End Sub
VIPER5646 25 Junior Poster in Training

Hi all
I have a Products table which has a description and a size column the description is a string value and the size has a double value.
What I need to do is after reading the data it converts the decimals value of the size column into a fraction.
After the convertion I need to add a new column with the new fraction value onto the current datatable so I can populate the datagrid.
in the following code only the last value will be added on all the rows.

Private Sub ConvertDecimal2Fraction()
        Dim val As Double
        Dim fractColumn As New DataColumn
        Dim rowcnt As Integer = (dtOrder.Rows.Count - 1)
        For x = 0 To rowcnt
            If IsNumeric((dtOrder.Rows(x)(3).ToString)) Then
                val = CInt(dtOrder.Rows(x)(3).ToString)
                With fractColumn
                    .ColumnName = "xttl"
                    .Expression = ((dlgNewTop.Dec2Frac(val, 2)))
                End With
            End If
        Next
        With dtOrder.Columns
            .Add(fractColumn)
        End With
    End Sub
VIPER5646 25 Junior Poster in Training

Thank You both for your replies.
I had IsMdiContainer set to true.
Tinstaafl your solution worked I Disabled the CheckIfOpen and that did the trick.