lolafuertes 145 Master Poster

I would test if adding a FormattingApplied to true is enough:

Private Sub dataGridView1_CellFormatting(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting


        If Me.DataGridView1.Columns(e.ColumnIndex).Name = "Due Date" Then

            If e.Value IsNot Nothing Then
                Dim dgvdate As String = e.Value.ToString
                ' MsgBox(dgvdate)
                If dgvdate = "5" Then
                    e.CellStyle.ForeColor = Color.Red
                Else
                    e.CellStyle.ForeColor = Color.Green
                End If
                e.FormattingApplied = True
            End If
        End If
    End Sub

Maybe you'll need to also format the value manually.

Hope this helps

lolafuertes 145 Master Poster

Can you put the piece of code and signal the line where you get the error?

lolafuertes 145 Master Poster

I use 5 CISCO 1131 AG since 2 years ago running 24/7 with no problems.
They are configured to use IPSEC and Radius, and to exchange keys every few seconds to encript the WiFi transmission because security is a must.

lolafuertes 145 Master Poster

Please, be so kind to confirm:
1) Disk C: has been NTFS formatted
2) The folder C:\DailyLog exists
3) The user running the application has Modify permission to this folder and almost Read permissions on C:\
4) The file C:\DailyLog\logo.gif does not exist before saving

Thanks in advance

lolafuertes 145 Master Poster

Can you be so kind to show us the current code?

lolafuertes 145 Master Poster

You can change every assignement by using the IIF(test, true_part, false_part) function:

Formreceipt.Label1.Text = IIF(lvlist2.Items.Count > 0, lvlist2.Items(0).SubItems(1).Text, "")
Formreceipt.Label1.Text = IIF(lvlist2.Items.Count > 1, lvlist2.Items(1).SubItems(1).Text, "")
Formreceipt.Label1.Text = IIF(lvlist2.Items.Count > 2, lvlist2.Items(2).SubItems(1).Text, "")
'
'    etc.
'
.
.

Hope this helps

lolafuertes 145 Master Poster

You can simulate a router using your PC with some server or professional version of windows or using Linux, while putting more than one lan card (10$ each) in the PC.

Better if you can find almost 3 PCs, old, cheap (max 100$), to do it. And of course 2 small switches (30$ each)

Then tou can play in the concepts of IP networks, sublans, VPNs, Firewalls, routers, bridges using the starndard utilities provided with the OS.

When the conceps are clear is easier to lern a language (like Cico IOS) ) to do it.

Hope this helps
Hope this helps

lolafuertes 145 Master Poster

I'm confused.
Do you find all the items added to the list box in the listbox.items collection?

Just to debug, add a msgbox lstStatus.Items.Count after adding the txt to verify if the counter increases.

Please let us know the results

lolafuertes 145 Master Poster

Inorder to reflect the added items try

Public Sub SetStatus(txt as string) as string
lstStatus.Items.add(txt)
lstStatus.Refresh
System.Windows.Forms.Application.Doevents() ' gives time to refresh the screen
End Sub

Hope this helps

lolafuertes 145 Master Poster

In order to debug where the problem is, I will suggest:
1) Just before the ExecuteNonQuery take the Command string content and paste it into a new View (using SQL) in the Access DB and try it. If there is any syntax error ACCESS will help you do find where.
2) Do not surround with apostrophes the numeric fields
3) If there is a date field, be careful with the format passed to ACCESS

Hope this helps

lolafuertes 145 Master Poster

Better use Decimal.

lolafuertes 145 Master Poster

Two issues:
1) if GrandTotal is a float in the DB, do not surround the number with quotes in the SQL sentence
2) Searching on a float is generally not a good idea, because the internal precission representation of exponent and mantissa.

Please, can you be so kind to indicate what is the contents of strSQL before executing the SQL command?

Thanks in advance

lolafuertes 145 Master Poster

I Undertand.

Instead of looping on IsBusy you can:

dim myString as String
Function GetSite(ByVal as URL as String)
StartDownload(URL)
WebBrowser1.DocumentText = mystring
Retrun Nothing
End Function
Dim DataReceived as Boolean
Function StartDownload(ByVal URL As String)
Dim _client As New Net.WebClient
        Dim URL As String
        AddHandler _client.DownloadStringCompleted, AddressOf DownloadStringCompleted
        If My.Computer.Network.IsAvailable Then
            DataReceived = False
            _client.DownloadStringAsync(New Uri(URL))
            Do While Not DataReceived
                System.Windows.Forms.Application.Doevents()
            Loop            '
    End If

Return Nothing
End Function

Function DownloadStringCompleted(ByVal sender As Object, _
ByVal e As system.Net.DownloadStringCompletedEventArgs)
    DataReceived = True               
    If e.Cancelled = False AndAlso e.Error Is Nothing Then
         myString = CStr(e.Result)
    End If
Return myString
End Function

Hope this helps

lolafuertes 145 Master Poster

DoEvents() just softly 'halts' executing the current thread and gives the oportuniti to other threads or applications to acces to CPU time, then returns to the next sentence. So it will loop until IsBusy is false. At this moment, also the DownloadStringCompleted will be fired.

I'm not sure why it returns an empty string as it 'should' return the answer. Should I assume that if you get it sync then you have a non empty response (even the GUI is frozen)?
Did you tried to set the event handler before the call to the DownloadStringAsync?
Is the DownloadStringCompleted event fired at any time?

Thans in advance for the info

lolafuertes 145 Master Poster

After

AddHandler _client.DownloadStringCompleted, AddressOf DownloadStringCompleted

you should 'wait while is busy'

Do While _client.IsBusy
    System.Windows.Forms.Application.Doevents()
Loop
'
' And wait for the event to be fired
'
System.Windows.Forms.Application.Doevents()

Hope this helps

lolafuertes 145 Master Poster

This should work OK.

Can you put the entire piece of code and signal what and where you are testing to obtain the wrong result?

Thanks in advance

lolafuertes 145 Master Poster

Can you try to use the resulting Dataview instead of the table, because the table is never sorted while the view is:

Dim Dv as Data.DataView
Dv = SortData(dtDTBM)

If resultCheckEndOfYear = True Then
    BalanceEndOfYear(Dv)
Else
    Call BalanceData(Dv)
End If

And change the Sort function as

Private Function SortData(ByVal dtDTBM As DataTable) As DataView
    dtDTBM.DefaultView.Sort = String.Format("{0} {1}", "qFundCode", "ASC")
    Return dtDTBM.DefaultView
End Function

Also you should change the definitions of

Private Sub BalanceEndOfYear(ByRef dtDTBM As DataView)
Private Sub BalanceData(ByRef dtDTBM As DataView)

Specially be carefull when passing parameters. A table or a view 'must' be passed ByRef instead of ByVal in order to work properly.

Hope this helps

lolafuertes 145 Master Poster

Show() enables both forms so is normal that you still have the mouse jumping on your parent form.

Showdialog() enables the child form while disabling the parent. Give it a try.

Hope this helps

lolafuertes 145 Master Poster

What is your current code?

lolafuertes 145 Master Poster

Did you declared the child form as MDI child and set the MDI parent to the MDI one?
Do you open the child with show() or with ShowDialog()?

Thanks

lolafuertes 145 Master Poster

In red my suggestions:

Imports System.Data.SqlClient

Public Class frmPasscode
    Dim userPwd As String
    Dim userTxt As String
    Dim iLength As Integer
    Dim blnPwdFromKeyboard As Boolean
    Dim blnEnterPressed as Boolean = False

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

        Me.Visible = False
        SetLabelFont(Me)

        userPwd = ""
        lblPwd.Text = ""
        lblOK.Text = GetButtonText("POS.OK")
        lblCancel.Text = GetButtonText("POS.Cancel")
        lblMessage.Text = GetButtonText("POS.PasscodePrompt")


        Me.Visible = True
    End Sub

    Private Sub frmPasscode_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
     
        If xmlLocalPrinter Then
            Dim obj1 As New PrintDoc1
            Dim i As Integer = 0
            prtStrArr(i) = "" : i += 1
            prtStrArr(0) = "Bill Payment" : i += 1
            prtStrArr(1) = "CB" & Format(ViewCreditBalance(), "#,###,###.00") : i += 1
                     prtStrArr(2) = "Amount To Pay : " & SESSION_CURRENCY & " " & Format(frmMakePayment.TotalPayable, "#,###,###.00") : i += 1
         
            obj1.printMyDoc(3)
        End If
    End Sub

    Private Sub DisplayKey(ByVal sender As Object)
        If Not CheckPasswordControl() Then
            userTxt = Mid(sender.name, 4)

            iLength = Len(userPwd)
            If userTxt = "BackSpace" Then
                If iLength > 0 Then
                    userPwd = Mid(userPwd, 1, iLength - 1)
                    lblPwd.Text = Mid(lblPwd.Text, 1, iLength - 1)
                End If
            Else
                If iLength < 20 Then
                    userPwd &= userTxt
                    lblPwd.Text &= "*"
                End If
            End If
        End If
    End Sub


    Private Function CheckPasswordControl() As Boolean
        CheckPasswordControl = False
        If Not blnPwdFromKeyboard Then
            frmPopup.lblErrMsg.Text = GetButtonText("POS.MakePaymentAtCounter")
            frmPopup.YesNo = False
            frmPopup.QorEx = False
            frmPopup.ShowDialog()
            CheckPasswordControl = True
        End If
    End Function

    Private Sub frmPasscode_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
        blnPwdFromKeyboard = True …
lolafuertes 145 Master Poster

For the example I'll assume that Form2 is created using
Dim Form2 as New frmMyForm
being frmMyForm the class for the form being used


Then I will suggest to change the definition of sub Main as:

Sub Main(ByRef FormToUpdate as frmMyFomr)

Then inside the sub Main you can

FormToUpdate.Label2.Text = "I've prcessed a bit"
FormToUpdate.Label2.Refresh

Hope this helps

lolafuertes 145 Master Poster

At module level define:

Public EnterKeyPressed as Boolead = False

Then on the frmPasscode_KeyPress sub, after

ElseIf e.KeyChar = Chr(13) Then

add

If Not EnterKeyPressed Then
    picYes_MouseUp(Nothing, Nothing)
    EnterKeyPressed = True
End If

Hope this helps

lolafuertes 145 Master Poster

I prefer to write:

myCommand = New OleDbCommand("insert into payment  (slip) VALUES (" & wa.tostring & ") ", con)        'insert the value of "wa"

Hope this helps

lolafuertes 145 Master Poster

The + sign is actually representing the sum.

Cheese can be converted to a number while "youranswer is" can not.

Because InputBox returns always an string (that maybe empty) I would try some thing like

Dim Pizza As String
Dim Taco As String
Dim Cheese As String
Dim Cat As String = "You entered bad values"
Pizza = InputBox("Please Enter the first number")
Taco = InputBox("Please Enter the second number")
If Taco.Lenght>0 AndAlso Cheese.Length>0 then
    Dim iTaco as integer
    Try
        iTaco = Ctype(Taco, Integer)
    Catch ex As Exception
        Goto BadValue
    End Try
    Dim iPizza as integer
    Try
        iPizza = Ctype(Pizza, Integer)
    Catch ex As Exception
        Goto BadValue
    End Try

    Cheese = (iPizza + iTaco).ToString
    Cat = "youranswer is " & Cheese
End If
BadValue:
Print(Cat)

Hope this helps

lolafuertes 145 Master Poster

The starting object is a form?
If so, put breaks inside the Initialize Components and in the very first sentence on the form Load and Activate events to step through.

the starting object is a Sub
Put all the code of the sub inside a try /catch block. When the exception occurs, the stack trace can point you in the rigth direction.

Hope this helps

lolafuertes 145 Master Poster

On the ds you neew to add a new table

ds.Tables.Add("MyNewTable")

Then on ds.Tables("MyNewtable"), you need to add 5 columns

ds.Tables("MyNewtable").Columns.Add("Col1")
ds.Tables("MyNewtable").Columns.Add("Col2")
ds.Tables("MyNewtable").Columns.Add("Col3")
ds.Tables("MyNewtable").Columns.Add("Col4")
ds.Tables("MyNewtable").Columns.Add("Col5")

Then, you need to create a row to be added to the table

Dim MyNewRow As DataRow = ds.Tables("MyNewtable").NewRow

Here you must assign the values to the columns

MyNewRow.Item("Col1") = "A"
MyNewRow.Item("Col3") = "Book"
MyNewRow.Item("Col5") = "100"
MyNewRow.Item("Col2") = ds.Tables(0).Rows(I).Item(SourceItemIndex1)
MyNewRow.Item("Col3") = ds.Tables(0).Rows(I).Item(SourceItemIndex2)

After filling it you must add the row to the table

ds.Tables("MyNewtable").Rows.Add(MyNewRow)

Hope this helps

lolafuertes 145 Master Poster

Just a few comments.

Be sure to dr.close each data reader before closing the connection to the MySql database.

On the INSERT commnad I will change it to sime thing like:

strSQL = "INSERT INTO dbo.RetailerBalance([BoothID],[TransactionDateTime],[TransactionDate], [GrandTotal],) VALUES ('" & BoothID & "','" & Format(CurrentTranxDate,"yyyy-MM-dd") & "', " & (GrandTotal - (Dealer + Dealer1)).ToString.Replace(System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.CurrencyDecimalSeparator,".") & ")"

Specially importannt to replace the decimal character by a point, that is the decimal separator accepted by MySQL. If the decimal separatos is the comma, it would be interpreted as a field separator.

Also interesting to format the date as universal format in order do avoit MySQL to decide if 11/07/2010 means July 11th, or Novembert 7th.

Hope this helps

lolafuertes 145 Master Poster

@marketingmaniac:
On the original post jcfans wrote

may i know how to add 4 new column to existing table("customer") automatic after split the string?

Why is needed a Listview to add data to the existing "customer" table?

Wich is the mechanism that adds the items from the listview to the database?

Is necessary the header in order to add the records to the table?

Sorry, as jcfans I am lost.

lolafuertes 145 Master Poster

may i know how to add 4 new column to existing table("customer") automatic after split the string?

Assuming that the text top split is in a string called TextTosplit, and the split charcter is the "-", you can separate then into a string array using some thing like

Dim StringParts as String() = TextToSplit.Split("-"c)

To add this info in the ds.tables(0) as a new row you can:

If stringParts.Lenght = 4 Then' To verify that has the required number of fileds
    ds.tables(0).Rows.Add(StringParts)
End If

Hope this helps

lolafuertes 145 Master Poster

Did you already tryed:

For each C as Control In Form.Controls
'
'    Do here what you need for each control
'
Next

?

lolafuertes 145 Master Poster

There is a very big lot of things you can do with Excel: http://msdn.microsoft.com/en-us/library/syyd7czh(v=VS.80).aspx

Also you gan get the entire Excel Object Model at http://msdn.microsoft.com/en-US/library/wss56bz7(v=VS.80).aspx

lolafuertes 145 Master Poster

Asumming table2 beewn the PaseId and descriptino table, you can bind this table as datasource for a dropdown listbox in your aspx page. On the dropdownlist task you can select table2 as the data source, select the description in the data text field to display, and select the phaseid for the data value field of the dropdown list.

Hope this helps

lolafuertes 145 Master Poster

Please, put what you've coded so far and a signal where you have doubts.

lolafuertes 145 Master Poster

it is enough to change

objExcel.ActiveSheet.Cells(row, column).Value = "cell data"
lolafuertes 145 Master Poster

Add a sub like

Sub ApplyCulture(Byval SelectedCulturename as String)
	Dim Rm As New Resources.ResourceManager("YourProject.YourFormClass", System.Reflection.Assembly.GetExecutingAssembly())
	Dim Ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(SelectedCultureName)
	Me.Text = Rm.GetString("$this.Text", Ci)
.
.	' you need to do this for all controls having a distinct text depending on the language
.
	Me.btnWhatItWas.Text = Rm.GetString("btnWhatItWas.Text", Ci)
.
.
.
End Sub

Then call this sub at the load event of the form. Also when you want to change the interface language.

Hope this helps

lolafuertes 145 Master Poster

After

Dim con As New ADODB.Connection

Where do you add the connection string and issue the open method?

lolafuertes 145 Master Poster

From my knowledge there is no direct support for Hijri dates inside ACCESS. The best way is to save them into text form of CCYY-MM-DD.

You must write yur own functions in ACCESS to manage such dates as all the 12 months are 28 days each.

lolafuertes 145 Master Poster

Your SELECT, as is written, is called a cross join. This will mean that all the rows of facilitada are merged to each row in customer data, then the resulting set is merged to each row in employee data.

If you have 3 rows in the first table, 2 on the second one and 4 in the 3rd the result will be 24 rows.

Maybe this is not what you expect.

Try to change the SELECT using some INNER JOIN clause defining how to relate the tables.

Hope this helps

lolafuertes 145 Master Poster

In the form where you pull the data from Table1, change the select string to 'join' both tables using the integer identifying the phase on each one like
"SELECT [Table1].[CurrentPhaseInt], [Table2].[Description] FROM [Table1] INNER JOIN [Table2] ON [Table1].[CurrentPhaseInt] = [Table2].[PhaseIdInt] "

Hope this helps

lolafuertes 145 Master Poster

Hopefully you have a Main (parent) form, where to place the tool strip, that you already set the IsMdiContainer property to True.
When you launch the additional forms from this one, you set the MdiParent property of the children form pointing to the Main form.

Dim F as new frmChildForm1
F.MdiParent = Me
F.Show

In each child form, you should add a Public sub or function that deletes the data related only to this child form.

Public Sub Delete
'
'    Delete whatever you need
'
End Sub

On the Main form, when the user clicks the tool strip 'Delete' button, you can cicle over the children forms

For Each ChildForm as Form In Me.Children
    
Next

Inside the loop you can place validations to determine wich one is the child form and call the Delete sub

If ChildForm Is frmChildForm1 Then
    Directcast(ChildForm, frmChildForm1).Delete
ElseIF ChildForm Is frmChilForm2 Then
    Directcast(ChildForm, frmChildForm2).Delete
.
.
.
Else
    ' Do Nothing
End IF

Hope this helps

lolafuertes 145 Master Poster

On your setup project, if you click with the alternate buttonon it, then a View /file System menu can be selected.

On this view, verify the 'Application Folder' DefaultLocation property to verify on wich folder is installed your program.

If you really need to add a specific folder, on the left pane, click with alternate button and open the 'Add special folder' / 'Custom Folder'

Set a name for the folder and in the DefaultLocation property put the expected path.

With this custom folder selected, alternate clicking on the right pane, you can add the files to be copied to the folder during the installation.

Hope this helps

lolafuertes 145 Master Poster

Sorry.
Really you do not need to add the printform in the controls of the form.

Please try some thing like:

Public Sub PrintScreen(ByRef frm As System.Windows.Forms.Form, ByRef FormHeight As Short)
	PrintForm1.DocumentName = frm.name ' or fr.text or whatelse to identify it
	PrintForm1.Form = frm
	PrintForm1.PrintAction = System.Drawing.Printing.PrintAction.PrintToPrinter
	PrintForm1.PrinterSettings = CType(resources.GetObject("PrintForm1.PrinterSettings"), System.Drawing.Printing.PrinterSettings)
	PrintForm1.PrintFileName = Nothing
.
.
	PrintForm1.Print(frm, PowerPacks.Printing.PrintForm.PrintOption.CompatibleModeClientAreaOnly)
.
.

End Sub

or whatelse you need to do with the PrintForm1.

Hope this helps

Simran Kaur commented: was helpful +1
lolafuertes 145 Master Poster

Chang your line 10 of code to

oBook = oExcel.Workbooks.Open("C:\DailyLogs\DailyLog.xlsx")

Hope this helps

lolafuertes 145 Master Poster

Cicle over the items and determine wich one is to be removed from the list.

Just as a hint, if you cicle from last to first, removing the item will not affect to the loop.

Dim ValueToSearchFor as String = "XYZ"

For I as Integer =  ListBox1.Items.count - 1 to 0 step -1
  If ListBox1.Items(I).Tostring.Trim.Length = 0 then
    ListBox1.Items.RemoveAt(I)
  Else
    If ListBox1.Items(I).Tostring.IndexOf(ValueToSearchFor)<>-1
      ListBox1.Items.RemoveAt(I)
    End If
  End If
Next

Hope this helps

lolafuertes 145 Master Poster

IMO you need to do significant changes to your code:

First, your data adapter needs to define also the Insert, the Update and the Delete commands, or nothing will happen to the data base when you issue a da.update. The Delete command sould only be defined once, not at every button delete click event.

Second, executing a da.update just after a da.fill has no effect. Did you cleared the previous content of the table before filling it?

Third, on the button delete event is enough to execute the dr.delete for deleting the record in the DS. Also to modify the dr you can dr.beginedit, do the changes in the dr fields an then do dr.endedit. All the changes are performed into the datasetEmp in memory.

Finally, on the button save is enough to issue the da.update for the datasetEmp, table datasetEmp.Tables(0).Name to insert, update or delete all the modified, inserted or deleted records at once. Please refer to the example in the referenced article from Microsoft.

Hope this helps.


Hope this helps

lolafuertes 145 Master Poster

On your application, create a dataset showing the underlying database.
Fill it in using the data adapters.

Show the data binding the datagrid to the tables in your dataset

When inserting, updating or deleting, do it against the tables in the dataset, then refresh the datagrid.

Once the users clicks the Save button, use the data adapters to update the underlying database.

You can find a detailed HowTo in http://support.microsoft.com/kb/301248/en-us

lolafuertes 145 Master Poster

PrintForm Component might require to be declared.

frm.PrintForm1.Print(frm, PowerPacks.Printing.PrintForm.PrintOption.CompatibleModeClientAreaOnly)

The form "frm" must have a control that shoud be called PrintForm1.

To add a such control in the form "frm" you can:
1) On the designer of the form add the PrintForm Control
2) On the Load event, or any place in the form before calling the sub PrintScreen, and if there is no PrintForm control already defined,

Dim PrintForm1 as new PowerPacks.Printing.PrintForm
Me.Controls.Add(PrintForm1)

Hope this helps

Simran Kaur commented: was helpful +1
lolafuertes 145 Master Poster

You need to download the Power Packs for Visual Basic and install them. Then you sould fint the printform component to add to your form.

http://msdn.microsoft.com/en-us/vbasic/bb735936.aspx

Hope this helps

lolafuertes 145 Master Poster

Rich text is a sort of language where you define some attributes for the text in.

You can go to http://msdn.microsoft.com/en-us/library/aa140277(v=office.10).aspx to read about internal syntax of rich text.

Assuming you are saving the contents of the richtexbox rtf property in the SQL database, the easiest way is to write som kind of procedure to read the SQL data into a richtextbox, select the text into the richtextbox to change the font and size, do the changes on the selectedtext and then update the record in the SQL table wih the new rtf.

Hope this helps