Ok thanks a lot. And coming to think of it yes I really should find another way of tackling this problem.

Cheers :)

Hi,
I'm getting the following error: NullReferenceExceptionWasUnhandled on if (messageUserList[i].Contains("_0")).
I can't seem to find where the data is null. I've tried debugging using breakpoint yet no luck.

Basically what I intend to do is get the text from a particular textbox txtSendMsg and write it to messageList at position messageListPos. Then the textbox will be cleared. The current position messageListPos and current user currUser (which in this case is 0) will be writen to another array messageUserList at position messageListPos. So far the program identifies taht the value at messageUserList[messageListPos] is '0_0', (this I figured out from debugging). Later on the program will loop through the messageUserList until the length of messageList has been reached. If messageUserList at position i contains '_0' the program should apply the following effects and so on.

lbxChatHist is actually a TextBlock not a ListBox.

PS: I'm using WPF

string[] messageList = new string[System.Int16.MaxValue];
string[] messageUserList = new string[System.Int16.MaxValue];

byte[] userId = new byte[15];

byte currUser = 0;

int messageListPos = 0;

private void btnSendMsg_Click(object sender, RoutedEventArgs e)
        {
            messageList[messageListPos] = txtSendMsg.Text;

            txtSendMsg.Clear();

            messageUserList[messageListPos] = messageListPos.ToString() + "_" + currUser.ToString();

            for (int i = 0; i < messageList.Length; i ++)
            {
                if (messageUserList[i].Contains("_0"))
                {
                    lbxChatHist.FontFamily = new FontFamily("Century Gothic");
                    lbxChatHist.Foreground = Brushes.DeepSkyBlue;
                    lbxChatHist.FontWeight = FontWeights.DemiBold;
                    lbxChatHist.FontStyle = FontStyles.Normal;

                    lbxChatHist.Text += messageList[i];
                }

                lbxChatHist.Text += Environment.NewLine;
            }

            messageListPos++;
        }

Thanks,
Isaac Hili

Turns out I had a Syntax Error

function age()
{

    var invalidStr = "You must be at least 18 to subscribe.";

    var dateOfBirth = document.getElementById("dob").value;
    var dob = new Date(dateOfBirth);

    var dateOfBirthD = dob.getDate();
    var dateOfBirthM = dob.getMonth();
    var dateOfBirthY = dob.getFullYear(); 

    var currentDate = new Date();

    if (dateOfBirthY > (currentDate.getFullYear() - 18))
    {

        document.getElementById("invalid").firstChild.nodeValue = invalidStr;
        return false;

    }

}

Ok so I've tried that and it didn't really make a difference.

I've tried this code:

function age()
{

    //alert("Test 01");
    // Success

    var invalidStr = "You must be at least 18 to subscribe.";

    var dateOfBirth = document.getElementById("dob").value;
    var dob = new Date(dateOfBirth);

    //alert("Test 02");
    // Success

    var dateOfBirthD = dob.getDate();
    var dateOfBirthM = dob.getMonth();
    var dateOfBirthY = dob.getFullYear0(); 

    alert("Test 03");
    // Fail

    var currentDate = new Date();

    if (dateOfBirthY > (currentDate.getFullYear() - 18))
    {

        alert("Test 04");

        document.getElementById("invalid").firstChild.nodeValue = invalidStr;
        return false;

    }

    alert("Test 05");

}

It shows that my code is only being 'executed' till Line 13.

I've discussed this issue with my tutor / lecturer. He is willing to help me out. I'll keep this discussion open in the meantime and I'll try to keep you posted.

Thanks :)

onsubmit return false still submitting form

HTML:

<!DOCTYPE html>

<head>
    <script src = "Scripts/script.js"></script>
</head>
<body>
    <form action = "http://posttestserver.com/post.php" method = "post" onsubmit = "return age()">
        <label for = "dob">Date of Birth</label> <input class = "TextArea" type = "date" id = "dob" name = "dob" required/> <br/>
        <p><span id = "invalid">&nbsp;</span><br/></p>
        <input id = "FormSubmit" class = "Buttons" type = "submit" value = "Submit"/>
    </form>
</body>

Javascript:

function age()
{

    var invalidStr = "You must be at least 18 to subscribe.";

    var submitOK = true;

    var dateOfBirth = document.getElementById("dob").value;
    var dateOfBirthD = dateOfBirth.split("/")[0];
    var dateOfBirthM = dateOfBirth.split("/")[1];
    var dateOfBirthY = dateOfBirth.split("/")[2];

    var currentDate = new Date();

    if (dateOfBirthY > (currentDate.getFullYear() - 18))
    {

        document.getElementById("invalid").firstChild.nodeValue = invalidStr;
        submitOK = false;

    }

    return submitOK;

}

PS: External Javascript is not a problem since I have other scripts running in the background which worked fine

Sheet1
A1: Football
A2: Rugby
A3: Basketball

Sheet2:
A1: A2
A2: B4

How can I get a location of a field from String? Is it even possible?
eg. I want to tell the contents of cell A2 in Sheet1 by getting the string value "A2" from cell ''Sheet2'!A1'

Thanks

I'm trying to make a button that when pressed for a short while will close the form but when pressed for a long time e.g. 5s the form's process will be killed.

I'm trying to achieve this with a timer.

    Private Sub CloseLongTimer_Tick(sender As Object, e As EventArgs) Handles CloseLongTimer.Tick

        Dim SetTime As Integer = 0
        SetTime = SetTime + 1

        If SetTime < 500 Then

            Me.Close()

        ElseIf SetTime > 499 And SetTime < 1001 Then

            System.Environment.Exit(1)

        ElseIf SetTime > 1000 Then

            CloseLongTimer.Stop()

        End If

    End Sub

    Private Sub CloseButton_MouseDown(sender As Object, e As EventArgs) Handles CloseButton.MouseDown

        CloseLongTimer.Start()

    End Sub

Any help? I think it's a problem in logic. Thanks.

Favicon can have any size
I've tried it in various squarish sizes such as 16x16, 64x64 and 256x256.

Dunno maybe it was a cache problem?

Dunno maybe it was a cache problem?

hey guys for some reason my favicon decided to show up on both web browsers today :)

Do you want to show date like this, so that the user inserts date?

ComboBox1: Day
ComboBox2: Month
ComboBox3: Year

Yeah <M/> is right. Apart from that my code is correct as verified on forums such as stackoverflow.

actually I'm explaining the whole thing
thanks Michael but I already used that website to convert my png to ico

I don't own a website, I just created an html file locally on my HDD in a folder with all resources necessary. Somehow I can only see images that are uploaded online as a favicon. Therefore I might as well upload my favicon online to a website which offers cloud storage and stores the file name within the URL eg. www.example.net/favicon.png .

Off topic: Do you know any good and safe sites to upload my favicon to?
HTML file is saved locally.

I've tried Google Drive but that doesn't seem to work, most probabbly because it doesn't end with "favcon.ico".

Code is alright for sure. I've tried this image and it worked:
http://www.webalice.it/f.corriga/temp/g0000_palette.png

Could it be that my png / icon contains trasperency?

Code 01:

<head>

    <title> My Web Page </title>

    <link rel = "icon" href = "favicon.ico" />
    <link rel = "shortcut icon" href = "favicon.ico" />

</head>

Code 02:

<head>

    <title> My Web Page </title>

    <link rel = "icon" href = "favicon.ico" type = "image/x-icon" />
    <link rel = "shortcut icon" href = "favicon.ico" type = "image/x-icon" />

</head>

I've tried all these in .ico and .png but neither seem to work, at least on Chrome and IE10.

I have a 256 x 256 icon. I've also reduced the size to 16 x 16.

Plus I've tried using the full path to the file.

sorry n00b mistake
I forgot to enter an event handler
thanks

I need to to this: If the selected option / item is "Enabled" I want to preview a textbox.

I've tried this:

        If ComboBox6.SelectedItem = "Enabled" Then
            TextBox10.Visible = True
        Else
            TextBox10.Visible = False
        End If

And also this:

        If ComboBox6.Text = "Enabled" Then
            TextBox10.Visible = True
        Else
            TextBox10.Visible = False
        End If

Thanks in advance,
Isaac

PS: I'm using DropDownList

And how can I do this? I've searched for this feature in VLOOKUP but only found "the next highest value".

Thanks, the thing is that there are over 4000 records on each worksheet. I'll use VLOOKUP to sort some of them and I'll do the rest manually.

Hi thanks for your replies. Wouldn't the VLOOKUP require exact data. Say the Name in one table is Jean Paul Brown but in the other table it is Jean Brown, would the VLOOKUP be able to match them? The two IDs are different that's why I'm using names.

I've got these two tables on two different worksheets.

A1: ID        
B1: Name   
C1: Locality 
D1: ID_2     
E1: Status

A1: ID
B1: Name
C1: Locality
D1: Status

Basically I need to match the two tables via "Name". If the names are similar I want to fill in "ID_2" with "ID" in WS2. I also want to display "Y" in status if there's a match.

Is there a formula that does this? Or do I have to use VBA.

Office Version: 2003

Thanks

I'm trying to imitate the Windows 8 Start Menu preview'.

    Private Sub CornerHoverMouseOn() Handles CornerHover.MouseHover
        Dim CHL As Integer
        CHL = (Screen.PrimaryScreen.WorkingArea.Height - 100)
        CornerHover.Anchor = AnchorStyles.Bottom + AnchorStyles.Left
        CornerHover.Location = New Point(0, CHL)
        CornerHover.Height = 100
        CornerHover.Width = 50
        CornerHover.BackgroundImageLayout = ImageLayout.Stretch
        CornerHover.BackgroundImage = My.Resources.CornerHover
    End Sub

    Private Sub CornerHoverMouseOff() Handles CornerHover.MouseLeave
        Dim CHL As Integer
        Dim NewBackImage As System.Drawing.Image
        CHL = (Screen.PrimaryScreen.WorkingArea.Height - 50)
        CornerHover.Anchor = AnchorStyles.Bottom + AnchorStyles.Left
        CornerHover.Location = New Point(0, CHL)
        CornerHover.Height = 50
        CornerHover.Width = 25
        CornerHover.BackgroundImageLayout = ImageLayout.Stretch

    End Sub

I need to know how to remove the image frome the picturebox. I've tried dispose but that results into syntax errors.

Public Class Form1

    Dim CloseButton As New Close
    Dim RestoreButton As New Restore
    Dim MinButton As New Minimise

    Dim Drag As Boolean
    Dim MouseX As Integer
    Dim MouseY As Integer

    Dim WinBorder As New PictureBox

    Private Sub CloseButtonCode() Handles Me.Load
        CloseButton.Anchor = AnchorStyles.Top + AnchorStyles.Right
        CloseButton.Enabled = True
        CloseButton.Location = New Point(1170, 0)
        CloseButton.Size = New Size(30, 30)
        CloseButton.Visible = True
        Controls.Add(CloseButton)
        AddHandler CloseButton.Click, AddressOf CloseButtonClick
    End Sub

    Private Sub CloseButtonClick()
        Me.Close()
    End Sub

    Private Sub RestoreButtonCode() Handles Me.Load
        RestoreButton.Anchor = AnchorStyles.Top + AnchorStyles.Right
        RestoreButton.Enabled = True
        RestoreButton.Location = New Point(1140, 0)
        RestoreButton.Size = New Size(30, 30)
        RestoreButton.Visible = True
        Controls.Add(RestoreButton)
        AddHandler RestoreButton.Click, AddressOf RestoreButtonClick
    End Sub

    Private Sub RestoreButtonClick()
        If Me.WindowState = FormWindowState.Normal Then
            Me.Height = Screen.PrimaryScreen.WorkingArea.Height
            Me.Width = Screen.PrimaryScreen.WorkingArea.Width
            Me.Left = (Screen.PrimaryScreen.WorkingArea.Width - Me.Width) / 2
            Me.Top = (Screen.PrimaryScreen.WorkingArea.Height - Me.Height) / 2
        Else
            Me.WindowState = FormWindowState.Normal
        End If
    End Sub

    Private Sub MinButtonCode() Handles Me.Load
        MinButton.Anchor = AnchorStyles.Top + AnchorStyles.Right
        MinButton.Enabled = True
        MinButton.Location = New Point(1110, 0)
        MinButton.Size = New Size(30, 30)
        MinButton.Visible = True
        Controls.Add(MinButton)
        AddHandler MinButton.Click, AddressOf MinButtonClick
    End Sub

    Private Sub MinButtonClick()
        Me.WindowState = FormWindowState.Minimized
    End Sub

    Private Sub Border()
        WinBorder.Anchor = AnchorStyles.Top + AnchorStyles.Right + AnchorStyles.Left
        WinBorder.Enabled = True
        WinBorder.Location = New Point(0, 0)
        WinBorder.Size = New Size(1200, 30)
        WinBorder.Visible = True
        Controls.Add(WinBorder)
        AddHandler WinBorder.MouseDown, AddressOf WinBorderMouseDown
        AddHandler WinBorder.MouseMove, AddressOf WinBorderMouseMove
        AddHandler WinBorder.MouseUp, AddressOf WinBorderMouseUp
    End Sub

    Private Sub WinBorderMouseDown()
        Drag = True
        MouseX = Windows.Forms.Cursor.Position.X - Me.Left
        MouseY = Windows.Forms.Cursor.Position.Y - Me.Top
    End Sub

    Private Sub WinBorderMouseMove()
        If Drag Then
            Me.Top ...

Thanks

Close is a Custom Button I made.

    Dim CloseButton As New Close

    Private Sub CloseButtonCode() Handles Me.Load
        CloseButton.Anchor = AnchorStyles.Top And AnchorStyles.Right
        CloseButton.Enabled = True
        CloseButton.Location = New Point(1170, 0)
        CloseButton.Size = New Size(30, 30)
        CloseButton.Visible = True
        Controls.Add(CloseButton)
        AddHandler CloseButton.Click, AddressOf CloseButtonClick
    End Sub

Whenever I Maximise, this button doesn't move to the top right corner like it's supposed to. Any help? Thanks in advance.