lolafuertes 145 Master Poster

That maybe because the MainDepart table of the objAbsent.dss is empty. Can you check it?

How and when do you fill the tables?

lolafuertes 145 Master Poster

Answering the question of the quarantined files i would suggest the following:
Always copy the original file to the destination location, then Delete the original file. Never Move.
In order to recover the original file name i would suggest that when copying the original to the destination folder, change the name to a random Guid. Then create a file with the same random Guid + extensioon log (or some thing you define), and write there the info about the original file. This way you will always have pairs of files, the original and the info.

Hope this helps.

lolafuertes 145 Master Poster

Sorry, I am saying that many files can have the same hash value.
Also I am saying that is not possible to replace the hash value of a file with aonther.

As the hash value is the result of a calculation, you can not replace the result of the calculation to 'clean' the original file.

In order to see a simple example, If you have a hash value of 4, wich is the result of adding all the original positive numbers values together, what one is the right original file structure?
Possible answers:
Original has a lenght of 1 with value of 4. (this is easy)
Original has a lenght of 2 with the following possible pairs: 0 + 4 or 1 + 3 or 2 + 2 or 3 + 1 or 4 + 0
Original has lenght of 3 values with : 0 + 0 + 4 or 0 + 1 + 3 or .... 4 + 0 + 0
...
Original has 2Mbytes length: Fill in all the possible values here by your self :( .

With the value of 4, and the examples here, if the result of the calculation is to be 3 istead of 4, wich of the original file values is the right one to be modified? You can only apply the clean process (according to this algotrithm) if the file is 1 byte in length.

As the MD5 hash calculation is …

lolafuertes 145 Master Poster

The MD5 hash returns a 128 bits value (16 bytes lenght and340282366920938463463374607431768211456 distinct results are possible).

But... more than one source for the hash can have the same hash value, and there is no way to know the source for that result.

To know more about the collision results in MD5 please visit the Wikipedia page.

IMO, you should research for another approach to the 'repair' function.

Sorry.

lolafuertes 145 Master Poster

Do you use binary readers to read the file and the guide signatures?
Are always both o the same length?
Do you have a CompareSignatures function to retrieve if the guide signature is the
file signature?
Do you have a ReplaceSignature function?
How do you remove from memory a file already loaded to change their signature?

Just a comment on your delete all process. Lets do an example:
You have 3 Items in the ListBox.
The first Item is the 0, the second is 1 and the third is 2.

You select the first Item 0, kill the file and remove the item from the ListBox.

Actually you'll have 2 Itmes, 0 and 1, then you select the next (+1) SelectedIndex. This will be the 1. and kill the file an remove from the listbox.

Actually you'll have 1 Itmes, 0, then you select the next (+1) SelectedIndex. This will be the 2, probaly throwing an exception.

I would suggest to cicle the SelectecIndex from Items.Count-1 to 0 step -1 to avoid this error.

Hope this helps

lolafuertes 145 Master Poster

From my experience, you will increase yours just working on the field.

One way is to do a couple of projects for very low price (or even for free) then use them as a bright display for the new position.

An MCSE and/or CNE will also increase your certified skill levels.

Hope this helps

lolafuertes 145 Master Poster

Did you set the preview of keys in the form and catch the key events?

Please, post your code here.

lolafuertes 145 Master Poster

I think tou missed to set the selected index to 0 for the cmbMainDepartment when the if strAdminAccess and strSystemAdminAccess are both true.

Hope this helps

lolafuertes 145 Master Poster

Please, post what you have coded so far here.

lolafuertes 145 Master Poster

According to your code, the mywaithandles(0) may have no handle info at all.

I would suggest to sligly change your code to this untested example:

<MTAThread()> Public Sub file_search()
    Dim DD() As String = Directory.GetDirectories(Searcher_path)
    Dim mywaithandles() As AutoResetEvent = Nothing
    Dim currentHandleIdx as Integer = -1
    For i As Integer = 0 To DD.Length - 1
        If is_emty(DD(i))=false Then
            If mywaithandles Is Nothing Then
                ReDim mywaithandles(0)
            Else
                ReDim Preserve mywaithandles(mywaithandles.Length)
            End If
            currentHandleIdx = mywaithandles.Length -1
            mywaithandles(currentHandleIdx) = New AutoResetEvent(False)
            Dim th_info As Threadinfo = New Threadinfo(DD(i), mywaithandles(currentHandleIdx))
            ThreadPool.QueueUserWorkItem(AddressOf searcher_thread, th_info)
        End If
    Next
    If Not mywaithandles Is Nothing then WaitHandle.WaitAll(mywaithandles)
end sub

Hope this helps

lolafuertes 145 Master Poster

Mostly you loosed the primary domain controler roles.

I would recommend to deprecate this server to no Active Directory related role(stand alone).

Remove all the machines from the domain.

Restart the server to install the Active Directory as Primary Domain controller, adding all the necessary roles.

Add all the machines to the domain again.

Hope this helps

lolafuertes 145 Master Poster

I would suggest that for each existing item in the list, you show a new form in dialog mode to navigate to the web page.
when the user closes this form, the calling will go to the next item in the list.

Hope this helps

lolafuertes 145 Master Poster

This behaviour is usual when multi-threading is done in the code.

Multi-threading happens when using a timer, executing a backgroud worker, starting a thread, etc.

The best way we can tray to help you is if you post your code here and some one can try to 'see' where the problem is.

Hope this helps

lolafuertes 145 Master Poster

Sorry, the string concatenation operator is the plus sign (+).

lolafuertes 145 Master Poster

I think you can add a "<BR>" literal after each value like
response.Write(username.Text & "<BR>");

Hope this helps

lolafuertes 145 Master Poster

What happens is the bed number or roon numbers does no exists?

The bid or rid will be not given the right value; thus, using them will rely on a null reference.

Please test the returned value before using it.

Hope this helps

Hope this helps

lolafuertes 145 Master Poster

One way you can use the same database for both projects is using the same ODBC connection string to the database.

Or you can use the MySql class for .NET to be downloaded and installed from http://www.mysql.com/, with the same connection strig.

Hope this helps

lolafuertes 145 Master Poster

If you are using the second field in the row to fill the textbox then you can:

TextBox2_name.Text = DataGridView1.Rows.Item(2).ToString

Hope this helps

lolafuertes 145 Master Poster

Just as a hint, for each row in your Excel sheet, you can write an insert statement like:

"IF NOT EXISTS (SELECT TOP 1 RegistrationNo FROM MyTable WHERE RegistrationNo = " & CurrentRowRegistrationNumber & ") INSERT INTO Mytable VALUES (..."

And for the NULL value , just set the literal NULL in the VALUES right place or change the data table to define the missing fileds in the Excel as nort required (accepting null).

Hope this helps

lolafuertes 145 Master Poster

I'll try to answer your questions:
1) Where to put the class? I normally create each class in a separate source for that class. Obviously you can add the class in the same source you already have.
2) The IComparer.Compare will permit to sort the list or to verify if a key already exists.
3) The List usage is based on specialized list that will know the class structure, allowing the direct access to any list item key or property.

Hope this helps

lolafuertes 145 Master Poster

Please read here about the System.Drawing.Printing.PrinterSettings class.

Hope this helps

lolafuertes 145 Master Poster

Do you need an index to set the destination index value in the priceArray.

Dim Idx as Integer = 0

Then, On the enterButton_Click yopu need to add the value to the array like

priceArray(Idx) = Ctype(enterPriceTextBox.Text, Decimal) ' This can fail if the entered value is not numeric

Once entered in the array, you must increment the index to the next value and, if is greater than the upper bound of the array then disable the enterButton button to prevent further values being entered like

If Idx > 11 then
   enterButton.Enabled = False
End If

Hope this helps

lolafuertes 145 Master Poster

Maybe you can try some thing like this untested code:

'
'   Verify if the source directory exists
'
Dim sourceDirectory as New IO.DirectoryInfo(ToolStripStatusLabel3.Text)
Try
    If sourceDirectory.Exists = False then
        MsgBox("The source directory '" & ToolStripStatusLabel3.Text & "' does not exists.")
        Exit Sub
    End If
Catch ex As Exception
    MsgBox("Got the following error acessing to '" & ToolStripStatusLabel3.Text & "'& ControlChars.CrLf & Ex.Message)
    Exit Sub
End Try
'
'  Verify if the source file exists
'
Dim filetoMove As New IO.FileInfo(ToolStripStatusLabel3.Text & "\" & ListBox1.SelectedItem.ToString)
Try
   If filetoMove.Exists = False then
        MsgBox("The source file'" & ToolStripStatusLabel3.Text & "\" & ListBox1.SelectedItem.ToString & "' does not exists.")
        Exit Sub
   End If
Catch ex1 As Exception
    MsgBox("Got the following error acessing to '" & ToolStripStatusLabel3.Text & "\" & ListBox1.SelectedItem.ToString & "'& ControlChars.CrLf & ex1.Message)
    Exit Sub
End Try
'
'   Verify if the destination directory exists. If not exists then Create it.
'
Dim destinationDirectory as New IO.DirectoryInfo(FolderBrowserDialog1.SelectedPath)
Try
    If destinationDirectory.Exists = False then
        If MsgBox("The destination directory '" & FolderBrowserDialog1.SelectedPath & "' does not exists. Do you want to create it?", MsgBoxStyle.YesNoCancel) <> MsgBoxReturn.Yes Then
           Exit Sub
        End If
        Try
            destinationDirectory.Create
        Catch ex2 As Exception
            MsgBox("Got the following error creating the directory '" & FolderBrowserDialog1.SelectedPath & "'" & ControlChars.CrLf & ex2.Message)
            Exit Sub
        End Try
    End If
Catch ex As Exception
    MsgBox("Got the following error acessing to '" & FolderBrowserDialog1.SelectedPath & "'& ControlChars.CrLf & ex.Message)
    Exit Sub
End Try
'
'   Verify if the destination file already exists. If exists ask …
lolafuertes 145 Master Poster

The main goal is to avoid the situations where an unexpected exception is thrown.

Using try / catch blocks can help you to properly catch the execptions, but not to avoid it.

Even more, you need to code the actions to do when the catch block is hit. IE: If you are doing actions against a database, you can catch the exception that the connection is not 'alive'. What to do then?.

As a suggestion, when you'll catch an unexpected exception, always write a record in a log with the relevant data to be analyzed later, and, if the execption is unbearable, then end the application and show the log.

Later, with the log info, try to code the application to avoid the exception.

Hope this helps

lolafuertes 145 Master Poster

I would suggest to create a class for the numbers structure and properties like:

Partial Class NumberAndProperties : IComparer {
  public readonly int Key;
  public readonly int Property1;
  public readonly int Property2,
  public readonly int Property3;
  void New(int key, int property1, int property2, int property3){
    Key = key;
    Property1 = property1;
    Property2 = property2;
    Property3 = property3;
  }
  int IComparer.Compare(object a, object b){
    NumberAndProperties A = (NumberAndProperties) a;
    NumberAndProperties B = (NumberAndProperties) b;
    If (A.Key > B.Key) return 1;
    if (A.Key < B.Key) return -1;
   return 0;
  }
}

Then use this class for a List<NumberAndProperties> to hold the data. To do that
add

public List<NumberAndProperties> TheNumbers = new List<NumberAndProperties>();

inside the class, before the public void DataBase and change this piece to:

//this part will read the array passed from Form1
//also in this part, as the numbers from the array are being read, there 
//respective properties are given to them.
//Somewhat like this,
// if (numbers[i] == "0")
// {
// prop1 = 1;
// prop2 = 2;
// prop3 = 3;
NumberAndProperties newNumberAndProperties = new NumberAndProperties(numbers[i], property1Value, Property2Value, property3value);
TheNumbers.Add(newNumberAndProperties);
// }

Then, to retrieve any value, you can use the List<T> methods and properties, and you'll always get a NumberAndProperties class with the Key and the Property 1 to 3.

Hope this helps

lolafuertes 145 Master Poster

I would suggesto to do some changes in the Button1_Click sub like:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim strOriginalWords As String()
    Dim strPigLatin As String
        
    strOriginalWords = TextBox1.Text.Trim.Split(" "c)
    Label1.Text = ""
    ForEach strWord as String in strOriginalWords
        Call Convert_to_Pig_Latin(strWord, strPigLatin)
        Label1.Text &= strPigLatin & " "
        strPigLatin = ""
    Next
    Label1.Text = Label1.Text.Trim
    Label1.Refresh()
End Sub

Another suggestion will change the Convert_to_Pig_Latin sub into function.

This is an untested code, but hope it helps.

lolafuertes 145 Master Poster

Without seeing your code is difficult to say what is the origin of the problem.

Instead of disposing the DGV, try disposing the Second form and creating a new one before showing in dialog mode.

Hope this helps.

lolafuertes 145 Master Poster

Just some hints.

On the getLastId sub, you miss to close the datareader. It is required for the loadOrder to work.
Maybe, the getTotals sub must be called after the loadOrder to have all the info.

If you need to load the info from only one order number, i will clear the grid view between

If oleDBDR.HasRows Then
DataGridView1.RowCount = 0
While oleDBDR.Read

Hope this helps

lolafuertes 145 Master Poster

You can use a loop/end loop to still searching while <pre> is found.
Also you need to use the last position of the </pre> to start the new search from that point.
This is an untested excample:

start = htmlsource.indexof("<pre>")
Loop While start <> -1
   start += 5
   end = htmlsource.indexof("</pre>", start)
   lenght = end - start
   MsgBox(htmlsource.Substring(start, lenght), vbokonly, "TESTING...")
   start = htmlsource.indexof("<pre>", end + 6)
End Loop

Hope this helps

lolafuertes 145 Master Poster

There is no insert, no update and no delete commands of the dataadapter to be used in the da.Update(ds, "Register") sentence.

Please provide the corresponding commands. (see here)

lolafuertes 145 Master Poster

It will split the line in as many words exist separated by a blank.

The first word (index 0 ) will contain the keyword. The rest of words (from 1 to the last) will contain other words in the input, if there is any other blank in the line.

lolafuertes 145 Master Poster

Use the string split to separate each line in the source info, using the # as separator char (this will remove the separator from the response.

The string split, will return an array of strings. Each element of hte array will contain one of the lines.

You will need to define a structure containing the 2 strings for Description and service.

Also tou will need a List, of the structure defined, in order to set it as the source for the list box.
For each line, if the line begins with DESCRIPTION (you can verify it using the IndexOf function) then copy the contents (after DESCRIPTION) to a description variable. Else, create a new variable, of the structure you defined, and fill the first field wir the description variable from the description line, and the second field, with the content (after SERVICE) and add it to the list.

After the last line is processed, set the list as data source for the list box, set the list box multicolumn property to true and refresh it.

Hope this helps

lolafuertes 145 Master Poster

@twalton42,

Mitja and I always said that you need to create separated, independent, data sources for each combo box, but you never show us how you did that.

The code you post above is not enough to see what you are doing, so we can not help further unless you create a zip with all your project and post it here.

Sorry for the inconvenience.

lolafuertes 145 Master Poster

Please, try to add

frmMain.lvTraining.Refresh()

just before the End Sub.

Hope this helps

lolafuertes 145 Master Poster

you can change this event as:

var returnList = e.Result.ToList();
dgv.ItemsSource = resultList;
txtlastrep.Text=(string) returnList[returnList.Count-1];

Hope this helps

lolafuertes 145 Master Poster

I normally install each application in a separate folder, to be able to mantain their assemblies separately, but, there is no restriction to install two or more applications in the same folder.

How the runtime locates assemblies is what determines wich assembly will be used by your application.

Hope this helps

lolafuertes 145 Master Poster

I'm glad you get the right info.

Please be so kind to mark this thread as solved.

lolafuertes 145 Master Poster

Glad to know.
Please be so kind to mark this thread as solved.

lolafuertes 145 Master Poster

In your code, line 44 you create a new dataset, overriding the previous. With this action, in your dataset you will have only one table. Instead youu need to have both.

I would suggest to remove this line.

Then, when you create the relation, in

DataRelation datare = ds.Relations.Add("percon", ds.Tables[0].Columns[0], ds.Tables[0].Columns[1]

You'll need to relate the table 0 columna 0 with the table 1 column 0
(assumming column 0 is the Customer id in both tables)

Hope this helps

lolafuertes 145 Master Poster

If you have a 'blank' (or any oder separator) between te number and the name, you can use the String.Split(" "c) function, from the Selected Item in the list box.

As the selected Item is the type of Object, you will need to convert it to type string, before using the Split.

Split returns an array of strings, not including the separator. If the ID is the first element then select the element 0 of the returned array.

Hope this helps

lolafuertes 145 Master Poster

Maybe. But, please read here about the licensing required.

Sincerely

lolafuertes 145 Master Poster

For your knowledge, and only if you prefer to implement your own sorting algorithm, there are a bunch of them.

Hope this helps

lolafuertes 145 Master Poster

One method can be:

Create a new empty ArrayList
Open the file with a text reader.
Then read the file one line at time using the readLine method until the end of file.
For each read line( if any ), add the string to the ArrayList.
Finally, close the text reader and return the ArrayList.

If you have some problems coding that, please show us how far you coded and the errors you find.

Hope this helps

lolafuertes 145 Master Poster

OOps. Too early in the morning ( or late in the night )

Please, be so kind to mark this thread ad solved.

Thanks in advance

lolafuertes 145 Master Poster

Probaly you are receiving the message because

MSDN: newName contains path information (ArgumentException).

Instead of

My.Computer.FileSystem.RenameFile("D:\Test\5prodigy1.mp3", "D:\Test\5prodigy1(songs.pk).mp3")

Try to use

My.Computer.FileSystem.RenameFile("D:\Test\5prodigy1.mp3", "5prodigy1(songs.pk).mp3")

Anyway I would prefer to use the System.IO functions like:

Dim sourceFile as New Syste.IO.FileInfo(filepath)
If sourceFile.Exists then
   Dim destinationFile as New System.IO.FileInfo(path)
   If destinationFile.Exists then
      MsgBox "Destination file already exists"
      '
      ' Can't rename
      ' TODO: Exit 
      '
   End If
   Try
      '
      ' To rename, move it
      '
      SourceFile.MoveTo(destinationFile.FullName)
   Catch ex as Exception
      ' Can't move
      ' TODO: Exit
   End Try
End IF

Hope this helps

lolafuertes 145 Master Poster
For Each lvi as ListViewItem in me.ListView1.Items

Sorry

lolafuertes 145 Master Poster

Just surround the new name with quotes.

lolafuertes 145 Master Poster

in me.ListView1.Items :)

lolafuertes 145 Master Poster

Assume you already have a main form in the project called frmMain that is the current startup object.
Add a new form to your project called frmLogin
In this form add a label "First name" and a text box textBoxFirstName.
Then add a label "Last name" and a text box textBoxLastName.
Add a button btnAccept and a button btnCancel
Define the btnAccept as the default button of the form (in the properties of the form)
Also define the btnCancel as the canccel button of the form
Then, on the properties of the buttons click on the event Click to capture it.

On the btnAccept_Click event add

If textBoxFirstName.Text.Trim.Length = 0 or textBoxLastName.Text.Trim.Length = 0 then
    MsgBox "Fill both"
    Exit Sub
End If
CurrentUserFirstName = textBoxFirstName.Text.Trim
CurrentUserLastName = textBoxLastName.Text.Trim
DialogResult=System.Windows.Forms.DialogResult.Yes
Hide

On the btnCancel_Click event add

DialogResult=Systtem.Windows.Forms.DialogResult.No
Hide

Just Create a New Module in your project
In this module add the following:

Public CurrentUserFirstName as string
Public CurrentUserLastName as String

Then add the following

Sub Main
    Dim F as new frmLogin
    Dim result as System.Windows.Forms.DialogResult = F.Showdialog()
    F.Close
    If result = System.Windows.Forms.DialogResult.No Then Exit Sub
    Dim mainFrm as new frmMain
    mainFrm.ShowDialog()
End Sub

On your project properties, change the startup object to be Sub Main.

Test the results

Hope this helps

lolafuertes 145 Master Poster

Please be so kind to describe the goal of your

Private Sub frangracecombolist_SelectedIndexChanged

and where you fill this fragancecombolist before the SelectedIndexChange event is fired.

Thanks in advance