Dec 14, 2005 #1 PIAS Programmer Nov 2, 2005 38 0 0 SI Can someone tell me how goes this VB function in C#; Weekday(dateYX,Microsoft.VisualBasic.FirstDayOfWeek.Monday) and this WeekdayName(dayX,False,Microsoft.VisualBasic.FirstDayOfWeek.Monday) Thanks PIAS
Can someone tell me how goes this VB function in C#; Weekday(dateYX,Microsoft.VisualBasic.FirstDayOfWeek.Monday) and this WeekdayName(dayX,False,Microsoft.VisualBasic.FirstDayOfWeek.Monday) Thanks PIAS
Dec 14, 2005 #2 Guru7777 Programmer Dec 10, 2003 331 0 0 US You can get the Day of the Week from Code: DateTime dt = DateTime.Today; Convert.ToInt32(dt.DayOfWeek); // will give you the # dt.DayOfWeek; // Will give you the Day ---------------------------------------- TWljcm8kb2Z0J3MgIzEgRmFuIQ== Upvote 0 Downvote
You can get the Day of the Week from Code: DateTime dt = DateTime.Today; Convert.ToInt32(dt.DayOfWeek); // will give you the # dt.DayOfWeek; // Will give you the Day ---------------------------------------- TWljcm8kb2Z0J3MgIzEgRmFuIQ==
Dec 19, 2005 Thread starter #3 PIAS Programmer Nov 2, 2005 38 0 0 SI ok, thanks for that Now i want to know what comes here; VB = UBound <=> in C# = ? Upvote 0 Downvote
Dec 19, 2005 #5 stsuing Programmer Aug 22, 2001 596 0 0 US This may help in the future http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html Conversion - not always perfect http://www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx Upvote 0 Downvote
This may help in the future http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html Conversion - not always perfect http://www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx
Dec 20, 2005 Thread starter #6 PIAS Programmer Nov 2, 2005 38 0 0 SI thanks, but i still have a problem i don't know how to change it: pozicije it's an array so how goes this code in C#; CInt(pozicije(i)) Upvote 0 Downvote
thanks, but i still have a problem i don't know how to change it: pozicije it's an array so how goes this code in C#; CInt(pozicije(i))
Dec 20, 2005 #7 stsuing Programmer Aug 22, 2001 596 0 0 US This will do the type conversion (int)pozicije if pozicije is an array of integers then you shouldn't have to do the conversion pozicije should suffice I have not tested these lines. Upvote 0 Downvote
This will do the type conversion (int)pozicije if pozicije is an array of integers then you shouldn't have to do the conversion pozicije should suffice I have not tested these lines.
Dec 21, 2005 Thread starter #8 PIAS Programmer Nov 2, 2005 38 0 0 SI It doesn't work. maybe becaus it is in for loop; Int32 oglas; SqlCommand oCmd; for (i=0; i<=(pozicije.Length); i++) { oglas = (int)pozicije; // oglas = CInt(pozicije(i)) oCmd.Parameters["@advId"].Value = oglas; oCmd.Parameters["@pozicija"].Value = i; oCmd.ExecuteNonQuery(); } this code give's me this error; Error 1 Cannot apply indexing with [] to an expression of type 'System.Array' Upvote 0 Downvote
It doesn't work. maybe becaus it is in for loop; Int32 oglas; SqlCommand oCmd; for (i=0; i<=(pozicije.Length); i++) { oglas = (int)pozicije; // oglas = CInt(pozicije(i)) oCmd.Parameters["@advId"].Value = oglas; oCmd.Parameters["@pozicija"].Value = i; oCmd.ExecuteNonQuery(); } this code give's me this error; Error 1 Cannot apply indexing with [] to an expression of type 'System.Array'
Dec 21, 2005 #9 stsuing Programmer Aug 22, 2001 596 0 0 US Maybe this working example will help int[] pozicije = new int[5]; pozicije[0] = 123; pozicije[1] = 321; pozicije[2] = 12345; pozicije[3] = 54321; pozicije[4] = 99999; for (int i=0; i<=(pozicije.Length -1); i++) { Console.WriteLine(pozicije); } Upvote 0 Downvote
Maybe this working example will help int[] pozicije = new int[5]; pozicije[0] = 123; pozicije[1] = 321; pozicije[2] = 12345; pozicije[3] = 54321; pozicije[4] = 99999; for (int i=0; i<=(pozicije.Length -1); i++) { Console.WriteLine(pozicije); }