Question: I have a precompiled struct as follow and unfortunately can not make changes in its definition

```
public struct SYSINFO          // Can not change/update this
    {
        public int ver;

        public struct printer
        {
            public string ver;
            public string serial;
            public string hserial;            
        }
        public struct laminator
        {
            public bool installed;
            public string ver;            
        }
    }

```

I am using this struct as out parameter in below code

```
uint test = smart.GetSystemInfo(out SYSINFO sinew); 
string number=sinew.printer.serial;   //<----Not working sinew doesn't have printer option

```

I need to get value of printer.serial property. I am using C# with .Net Framework 4.6.1. i can not change the struct definition.

Answer: 
For a more general solution, with my function you can easily find the first, second, third, forth or fifth sunday, monday, tuesday, wednesday or whatever you want:

```
Public Function GetXDayOfWeek(Day As DateTime,
                              DayOfWeek As DayOfWeek, 
                              Optional Index As Integer = 1) As DateTime
    Dim First As New Date(Day.Year, Day.Month, 1)
    Dim Diff As Integer = (DayOfWeek - First.DayOfWeek + 7) Mod 7

    Return First.AddDays(Diff + (Index - 1) * 7)
End Function

```

So if you want to find the forth wednesday of the current month, use it like:

```
Dim DateToFind As DateTime = GetXDayOfWeek(Today, DayOfWeek.Wednesday, 4)

```
Your while statement will stop on the first Wednesday it finds, not the fourth. Keep track of the number of Wednesdays you encounter as you iterate and once you find the fourth then you can update tbFour.

Also as mentioned in the comments you'll want to start at the first day of the year.

```
Dim fourthWed As Date = New Date(year, month, 1)

Dim wednesdayCursor As Integer = 0

While wednesdayCursor < 4

    If fourthWed.DayOfWeek = DayOfWeek.Wednesday Then

        wednesdayCursor += 1

    End If

    fourthWed = fourthWed.AddDays(1)

End While

'Subtract one day because we added one on loop:
fbFour.Text = fourthWed.AddDays(-1).ToShortDateString()

```