Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm not entirely sure if it's possible to have it both ways.
Allow the server to maintain the established connection between each client talking to each other, but to also establish a direct connection between the clients for sending of messages.

That would permit the server to run that connection timer and send instructions to each client ordering them to terminate the connection to each other. And also for the clients to have that close-to-real-time communication you want.
But it requires each client to run two threads, one listening to the server and the other for talking to the other client.

Oxiegen 88 Basically an Occasional Poster Featured Poster

In my opinion it's a bit hard to define "real time" as an actual amount of time.
How would you know the difference between 0.00 seconds and 5 seconds since you're not talking to yourself, nor may the other client not even be in the same building/room as yours.
Especially when text-chatting.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Yeah. My question was retorical. :)
The reason I asked was, if you manage to use the server to initialize the communication and then release it into the hands of the clients, then the server would no longer know anything about what's going on between the clients and thus not know when to kill the connection.
But, if you keep the server as a relay and force the clients to communicate through the server, then you can use those countdown timers. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Consider this, two clients are merrily talking to each other. How and when would the server know when to cut the connection?

Odd that you did'nt find any articles at all.
Most articles out there describes how it's done. Listen and send. That's peer-to-peer.
All those types of clients that you can download has that built-in. They listen for an incoming handshake connection, send a response, listen for data, send data.
The server is, sort of, also a peer-to-peer client but with the ability to recieve commands on which it can act on.

Here's a good example of a peer-to-peer solution: http://www.codeproject.com/Articles/1297/Peer-to-Peer-Communicator-and-File-Transfer

Here's a good video tutorial of a client-server solution: https://www.youtube.com/watch?v=MSiBbtxWpI8
He mentions's that the list of clients can come from any type of collection.
For me, that includes a database.

Here's a sample multi-user client server solution: https://code.msdn.microsoft.com/Simple-Multi-User-TCPIP-1ff0da41

Good luck! :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

By using the server as the initial connector between clients and then handing it off to the clients themselves to "talk", you may not be able to have the server restablish control and break the connection.

Your best bet is, as I said, to have the server be the constant relay.
Also, unless you store/log the communications between the clients then all data transfers are private. Considering that the communication also is semi peer-to-peer.
You also might wanna implement some kind of client-side encryption/decryption to ensure that, should the clients wish to go private.
Using a pre-defined random key sent by the requesting client, you can ensure that the recieving client decrypts the data correctly.

The use of Client(index) tells me that you have a fixed array of client IP's.
It needs to be a by-command dynamic call to the datasource, and you only need to remember the client requesting the peer-to-peer connection and the client-requestee.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I think that you have pretty much answered your question yourself already.
If you can send data between the client and server, then the server knows the IP of the client, right?
And also, because you can send data to the server it's quite easy to send a command the server can respond to.
Just add code to read/write the database with the requested username as an argument and start a new thread that communicates with the requested second client, if online.

Threads in VB.NET can be made to talk to each other, so shuffling data between the two (or three or four) is possible in order to allow communication between two clients with the server as the go-between.
There are many examples and tutorials, both here and other sites, that can show you how to accomplish this.
Like this one: Share Information Between Threads

Oxiegen 88 Basically an Occasional Poster Featured Poster

In that case, wipe the drive.

And I would start by installing the various mobo drivers first (chipset, usb and so on).
After that I usually go with the graphics drivers so that I get a decent display to work with. Other than that, you can install them in whatever order you like.
Just remember to finish off with a few hours of windows update. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Do you know for a fact whether or not the recovery partition doesn't contain the factory install of Win7?
If it does you can just find the correct button to press/hold while booting and reset the system.

Otherwise, go right ahead and remove it all.
You can do that during the install of Win7. Just hit the big Custom button and remove any and all partitions from there, and create a new one as you see fit.

Oxiegen 88 Basically an Occasional Poster Featured Poster

It's usually found in the /etc/apache or /etc/httpd directory depending on which linux distro you're using.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Here's the deal.
Practically everything under and including www should be owned by the webserver.
Check the config to see what user the server runs as, and change files and directories using the chown command.
Otherwise the webserver and scripts cannot perform any file or directory action.

You can later on lock it up some using a .htaccess file.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. List the files and folders with the -al argument, the name of the owner should be there.
Normally the name of the webserver should be apache (if you run apache).
If the files are not owned by the webserver, simply change that with the chown command.

Oxiegen 88 Basically an Occasional Poster Featured Poster

The directory in which the php script resides in must be owned by the webserver.
Also, check to see if the correct permissions are set. Scripts run by mod_php should require 0644 at the least.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Try this:

If dr.HasRows Then
    dr.Read()
    If IsDBNull(dr("MAXIMUM")) Then
        empid = 1
    Else
        empid = CInt(dr("MAXIMUM")) + 1
    End If
Else
    empid = 1
End If
dr.Close()

Me.txtmaxvalue.Text = empid

That's all you need.
Because the SQL string will only return ONE record, you don't have to use a While loop. Just do a simple one-liner dr.Read().

Oxiegen 88 Basically an Occasional Poster Featured Poster

No matter what the database backend is and no matter what type of database connection you use, you can still throw SQL commands at it and it will return the data.

Dim value As Integer
Dim con As New OleDbConnection(<connectionstring>)
Dim com As OleDbCommand

Private Sub ReadValue()
    com = New OleDbCommand("SELECT MAX(<column>) FROM <table>")

    con.Open()
    Dim reader As OleDbDataReader = com.ExecuteReader()

    If reader.HasRows Then
        reader.Read()
        value = reader(0)
    End If
    reader.Close() '<-- Note! Do NOT use con.Close() here.
End Sub

Private Sub AddAndInsert()
    value += 1

    com = New OleDbCommand("INSERT INTO <table> (<column>) VALUES (" & value & ")")

    con.Open()
    com.ExecuteNonQuery()
    con.Close()
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

This is a fully working code.
I noticed one thing that caused problems. The column name Size is a reserved word, so you need to put brackets [] around it.

Imports System
Imports System.IO
Imports System.Text
Imports System.Data.OleDb

Public Class frmBirthdayCake
    Private sql As String = "SELECT CakeID,Cake_Name,Cake_Description,Weight,Price,Image,ShelfLife,[Size],NoOfServings FROM Birthday_Cake"
    Private dt As New DataTable
    Private con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\CakeAlbum.accdb")
    Private adapter As New OleDbDataAdapter(sql, con)
    Dim index As Integer

    Private Sub frmBirthdayCake_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con.Open()
        adapter.Fill(dt)

        DataGridView1.DataSource = dt
        DirectCast(DataGridView1.Columns("Image"), DataGridViewImageColumn).ImageLayout = DataGridViewImageCellLayout.Stretch

        For i As Integer = 0 To dt.Rows.Count - 1
            Dim row As DataGridViewRow = DataGridView1.Rows(i)
            row.Height = 60
        Next

        DataGridView1.Columns("Image").Width = 150
        con.Close()
    End Sub

    Private Sub btnNext_Click(sender As System.Object, e As System.EventArgs) Handles btnNext.Click
        If TextBox1.Text = "" Then
            index = 0
        ElseIf index = dt.Rows.Count - 1 Then
            Exit Sub
        Else
            index += 1
        End If

        TextBox1.Text = dt.Rows(index)(0)
        TextBox2.Text = dt.Rows(index)(1)
        ReadImage()
    End Sub

    Private Sub btnPrevious_Click(sender As System.Object, e As System.EventArgs) Handles btnPrevious.Click
        If TextBox1.Text = "" OrElse index = 0 Then
            index = 0
        ElseIf index = dt.Rows.Count - 1 OrElse index <> 0 Then
            index -= 1
        End If

        TextBox1.Text = dt.Rows(index)(0)
        TextBox2.Text = dt.Rows(index)(1)
        ReadImage()
    End Sub

    Private Sub ReadImage()
        Try
            Dim imageBytes() As Byte = CType(dt.Rows(index)(2), Byte())
            Using ms As New MemoryStream(imageBytes)
                PictureBox1.Image = Image.FromStream(ms)
                PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
            End Using
        Catch ex As Exception

        End Try
    End Sub

    Private Sub DataGridView1_CellMouseClick(sender As Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles …
Ashveen96 commented: thanks a lot this works!!! +0
Oxiegen 88 Basically an Occasional Poster Featured Poster

Simple SQL query: SELECT MAX(<column name>) FROM <table>
The MAX() function works with both numbers and strings.
http://msdn.microsoft.com/en-us/library/ms187751.aspx

Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. You can't pass information back to the main form if you close it.
You have already hidden it. Isn't that enough?

Suggestion. If the second form is nothing but a data retriever, sorter and parser, open it as a modal form instead and throw a progressbar on it or something and keep the main form open in the background.
When the job is done, close the second form from within itself.

Oxiegen 88 Basically an Occasional Poster Featured Poster

It sounds like those "texts" that you scrape from the screen are log messages of some type.
Wouldn't it be easier to create a program that connects to the server and retrieve those log files, instead of scraping the screen or in this case the content of another program.

If you absolutely need to go the scrape way, there are only two options.
1) Capture a screenshot and try to ocr it.
2) Create a hook to that software you're using and "read" the content of the objects being returned. (http://www.codeproject.com/Articles/33459/Spying-Window-Messages-from-the-Inside)

Oxiegen 88 Basically an Occasional Poster Featured Poster

You can remove the part with the newValue variable.
It does almost the exaxt same thing as the three lines above it.

Oxiegen 88 Basically an Occasional Poster Featured Poster

You need two string variables.

You can perform a line read using the appropriate filereader object and append the line into a temp string variable through a simple loop.
And for each line you can in addition perform some string manipulation.
So for each line the only contains "" or " ", you can skip to the next line so that empty lines do not get read into the permanent string variable.

Additionally, during the manipulation phase you can do a simple string replacement.
:'++' becomes vbNewLine (or vbCrLf) and so on.
By using two variables you can append the last know good string to the "real" string.

The String object contains a whole bunch of useful tools to do exactly what you're asking for.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Have a look at Gembox Spreadsheet.
You can do pretty much anything with it concerning excel/xml.

Oxiegen 88 Basically an Occasional Poster Featured Poster

If you create and add controls through code then those controls will not have any events tied to them.
When you open the second and third panels and create controls in them, you also have to use the AddHandler statement and tie that to the txbUM_KeyDown event, or use a generic event and tie all three textboxes to it using AddHandler.

'For panel 2
AddHandler txbUM2.KeyDown, AddressOf txbUM_KeyDown

'For panel 3
AddHandler txbUM3.KeyDown, AddressOf txbUM_KeyDown

Like that.
And in the event itself you can use sender to identify which textbox triggered the event by using CType.

Dim tbox As TextBox = CType(sender, TextBox)
Oxiegen 88 Basically an Occasional Poster Featured Poster

It could be some residual service still running that's part of the game.
Check the Task Manager to see if there's something that uses a lot of CPU and/or memory.

Oxiegen 88 Basically an Occasional Poster Featured Poster

When you postback a form to the codebehind, all the formatting is there (except font and color).
But for some reason the database/datatype sometimes has problems retaining those.

When I ran into this problem on a project once, I simply read all the text from the textbox/textarea into a string variable and at the same time replace all occurences of linebreak with a ¤ sign (shift + 4).

Now, almost everyone know that the ¤ sign is almost never ever used for anything useful at all. As far as I know. :)
So a single linebreak/carrier return equals one ¤ sign, and a double linebreak (a paragraph) equals two ¤ signs.

And when you later on read the information from the database, you simply reverse the replacement. Replace the ¤ sign with a linebreak.
In VB.NET that would be VbCrLf.

Also. Converting all that text into html could pose a problem for you, becuase for some reason ASP.NET has some kind of built-in feature that thinks that certain kind of posted back HTML code is harmful, and thus will cause an exception error.

A way around that, I think, is to delve deeper into string replacement and figure out a way to use a combination of replacement characters for certain fonts and colors and formatting.
Like the one here on DaniWeb. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

It could be anything from .NET 2.0 to 4.0.
You just have to run the program and see if you have the latest needed version of .NET.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Run the Disk CleanUp utility.
You can find it in Start->All Programs->Accessories->System Tools.

And perhaps you should remove any and all unused software, like toolbars and crap like that.
While you're at it, install and run SpyBot Search And Destroy. It will detect and remove any and most malware/spyware/crap-ware/tracking-cookies that has been installed both with or without your knowledge.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm thinking that the easiest way to grab information from multiple tables is to create a view in the SQL server.
And from your code you can call upon that as if it was a single normal table.
All the mixing and matching using joins is handled by the server, so you don't have to concerns yourself so much about it in code.
The only drawback is that you can't modify the view in any way. Only read.

Oxiegen 88 Basically an Occasional Poster Featured Poster

It depends really on what language you're using for developmen of software.
But most of them do support the use of command-line arguments.
And no. Those are not limited to command-oriented systems, but can be used in Windows programs as well.

This is how it's done in C++

int main(char* argv[]) {
}

or the more conventional way

int main(int argc, char* argv[]) {
}

This is how it's done in C#:

static void Main(string[] args)
{
}

And this is how it's done in VB:

Sub Main()
    Dim args() As String = Split(Command$, " ")
End Sub

And this is how it's done in VB.NET:

Module Module1
    Sub Main()
        Dim args() As String = My.Application.CommandLineArgs
    End Sub
End Module

Was this an answer to your question?

Oxiegen 88 Basically an Occasional Poster Featured Poster

Then you should use the code I gave you.

ListView1.Items(reader.Item("PERSON")).Selected = True

Or at least read into a String variable first.

Dim strPERSON As String = reader.Item("PERSON").ToString()
ListView1.Items(strPERSON).Selected = True

I'm assuming that reader.Item("PERSON") contains a string of something that can be seen in the ListView.

Because as Poojavb said, SelectedItem is not a property of ListView.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Assuming that the item is not already present in the ListView. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Yeah. That code seem a bit cumbersome.
And you're not even using SLP, Admin or Pateint. So you can throw those away.
Also, in ASP.NET you can't use MsgBox. Add a Label and direct any output that that.
Try this instead.

 Public Sub LogIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim connStr As String = "Data Source=.\SQLEXPRESS;AttachDbFilename='C:\Users\sony\Documents\Visual Studio 2010\Projects\SADA\SADA\App_Data\SADA2.mdf';Integrated Security=True;User Instance=True"
    Dim logID As String
    Dim PassW As String

    Dim con As New Data.SqlClient.SqlConnection(connStr)
    Dim dtLogin As New DataTable
    Dim daLogin As New Data.SqlClient.SqlDataAdapter("SELECT * FROM LoginTable WHERE LoginID = '" & TextBox1.Text & "' AND Password = '" & TextBox2.Text & "'", con)

    Try
        daLogin.Fill(dtLogin)

        If dtLogin.Rows.Count > 0 Then
            logID = dtLogin.Rows(0).Item(0)
            PassW = dtLogin.Rows(0).Item(1)

            Select Case dtLogin.Rows(0).Item(5).ToString()
                Case "S"
                    Response.Redirect("SLPMain.aspx", True)
                Case "A"
                    Response.Redirect("Admin.aspx", True)
                Case "P"
                    Response.Redirect("WebForm4.aspx", True)
            End Select
        Else
            'lblError.Text = "Username or Password incorrect, or no such user is registered."'
        End If
    Catch ex As Exception
    End Try
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm no expert in Java.
But can you really assign an int to an instance of Track?
In the method setTrack(int trackNumber) you're assigning the argument to this.track which is an instance of Track.

And also, in the method getTrackName() you're returning this.trackName that doesn't seem to be declared anywhere.

I may be real off base here. But is that possible even for Java?

Oxiegen 88 Basically an Occasional Poster Featured Poster

This should help you.

ListView1.Items(reader.Item("PERSON")).Selected = True

This will only select the VERY first item

ListView1.Items(0).Selected = True
Oxiegen 88 Basically an Occasional Poster Featured Poster

By using a Try...Catch statement you can catch the error and do something about it.
It's a very useful debugging tool.

However, you don't have to enclose every single piece of altering code in it's own statement.
You can start the Try statement even before the line With Me and end it below the line End With, followed by the Catch statement with a messagebox displaying the error.

With On Error Resume Next, you won't know if an error occured and on what line.
So you have no way of knowing and thus can't do much about it.

Also.
Personally I feel that those types of error catching methods are depricated as they originate from the old-school VB type programming.
The Try...Catch statement is the .NET way.
That includes the use of MsgBox. Have you looked at MessageBox()?

Oxiegen 88 Basically an Occasional Poster Featured Poster

It might also be a good idea to specify the port in the connectionstring, even if it's the default one.
I found a bug report regarding that error message on MySql.com that suggested this could be the problem.

Oxiegen 88 Basically an Occasional Poster Featured Poster

On the client.

But you may also need to configure the mysql server to allow incoming connections to other than localhost.
In the permission table. (If I'm not mistaken).

Oxiegen 88 Basically an Occasional Poster Featured Poster

Try this:

SELECT * FROM table WHERE DateDiff(year, Now(), '" & <po date datetimepicker>.Value & " 00:00:00.0000000') = 3".
Oxiegen 88 Basically an Occasional Poster Featured Poster

Good.
Now, reformat the backup variable so that it looks like this:

Dim backupdb As String = driveletter & "{0:yyyyMMdd}" + ".accdb"

Notice that I removed ":\".

Oxiegen 88 Basically an Occasional Poster Featured Poster

What does backupdb look like?
And also, have you tried using backupdb without using String.Format(backupdb, Date.Today)?

Oxiegen 88 Basically an Occasional Poster Featured Poster

You can use both.
Just add a String variable to your code that will contain the selected drive from the returning ArrayList from my code.
Then use that variable and concatinate it with ":{0:yyyyMMdd}" + ".accdb"

    'This will get the very last available driveletter
    Dim driveletter As String = GetDrives().Item(GetDrives.Count -1)

    Dim backupdb As String = driveletter & ":{0:yyyyMMdd}" + ".accdb"
Oxiegen 88 Basically an Occasional Poster Featured Poster

Oh. Then no, I don't think it possible.
If the XBox is turned off, then the network connection is down.
But I am a bit surprised that you have to recreate the network connection. Once it's created is should just sit there.
However, I just remembered that there is a feature called Keep-Alive. Read this.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Depending on the format of the age column, you can limit the results by checking to see if the age is equal to or greater than the current year - 4.

Ex if column is DateTime/SmallDateTime datatype:
SELECT * FROM <table> WHERE YEAR(<asset age column>) >= 2009

Oxiegen 88 Basically an Occasional Poster Featured Poster

In order to avoid the flickering, use the SetStyle method of the form.

    Public Sub EnableDoubleBuffering()
       ' Set the value of the double-buffering style bits to true.
       Me.SetStyle(ControlStyles.DoubleBuffer _
         Or ControlStyles.UserPaint _
         Or ControlStyles.AllPaintingInWmPaint, _
         True)
       Me.UpdateStyles()
    End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Here's how you can get an ArrayList of available drives.

Imports System.IO

Public Function GetDrives() As ArrayList
    Dim drives As New ArrayList

    For Each drive As DriveInfo In My.Computer.FileSystem.Drives
        drives.Add(drive.Name)
    Next

    Return drives
End Function
Oxiegen 88 Basically an Occasional Poster Featured Poster

Here is an idea.

Oxiegen 88 Basically an Occasional Poster Featured Poster
Oxiegen 88 Basically an Occasional Poster Featured Poster

Iterate through the items in the ListView and check the .Text property if the selected item is already present.

For Each item As ListViewItem In lv.Items
    If item.SubItem(0).Text = <combobox>.SelectedItem Then
        MessageBox("The selected item is already added")
        Return
    End If
Next

item.SubItem(0) represents the very first column in the ListView.
Replace <combobox> with whatever name of the combobox you wish to check against.

Oxiegen 88 Basically an Occasional Poster Featured Poster

If the program relies on a database, just set up a central database server and have your program connect to it.
That's basically it.
Several copies of your program on various computers can connect to the database and share information.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Alright.
Then you can probably add a boolean variable that checks wether or not the mousebutton has been released.
And if so, exit from the MouseDown event.
I don't know if this is going to work. I've never tried it myself, but it should give you some ideas.

Private Sub control_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles control.MouseDown
    If bMouseClicked = True Then Return

    'The original MouseDown code
End Sub

Private Sub control.MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles control.MouseClick
    bMouseClicked = e.Clicks > 0
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Why not skip the MouseDown event all together and move that code into a method that you call at the end of execution in the MouseClick event?