I need to port the following from the ASP.NET MVC 2 sourcecode from C# to VB.NET. It's from AuthorizeAttribute.cs beginning on line 86:
HttpCachePolicyBase cachePolicy = filterContext.HttpContext.Response.Cache;
cachePolicy.SetProxyMaxAge(new TimeSpan(0));
cachePolicy.AddValidationCallback(CacheValidateHandler, null /* data */);
wher...
Say I have a controller called "HomeController" which inherits from Mvc.Controller. Also say I have written the constructor of the controller and some filters for some actions.
Public Class ClientController
Inherits System.Web.Mvc.Controller
Public Sub New()
''Some code
End Sub
<SomeActionFilter()> _
Functi...
I have a problem with VB9 and Moq.
I need to call a verify on a Sub. Like so:
logger.Verify(Function(x) x.Log, Times.AtLeastOnce)
And my logger looks like this:
Public Interface ILogger
Sub Log()
End Interface
But with VB this is not possible, because the Log method is a Sub, and thereby does not produce a value.
I don't want...
I have a asp.net web form which will submit information to come as emails. Whenever user fill the form and click on submit button,the information user entered will be sent as email.
This web form has 4 page. but the web form will not use all 4 page on all requests.
if the user select a particular value in first page, the form will bypa...
When we have new in C#, that personally I see only as a workaround to override a property that does not have a virtual/overridable declaration, in VB.NET we have two "concepts" Shadows and Overloads.
In which case prefer one to another?
...
Hi all I have the following code:
Public Shared Function ConvertToString(ByVal list As IList) As String
Dim strBuilder = New System.Text.StringBuilder()
Dim item As Object
For Each item In list
strBuilder.Append(obj.ToString())
strBuilder.Append(",")
Next
Return strBuil...
Hi folks,
I have a text box which has a Ajax calendar extender attached. You click on the text box, the calendar pops up, you select a date and that gets displayed in the text box. That all good but the date is displayed in mm/dd/yyyy format. Can this be changed?
Thanks,
Jonesy
...
Hi,
does somebody knows how to check for a valid IMEI?
I have found a function to check on this page: http://www.dotnetfunda.com/articles/article597-imeivalidator-in-vbnet-.aspx
But it returns false for valid IMEI's (f.e. 352972024585360).
I can validate them online on this page: http://www.numberingplans.com/?page=analysis&sub=im...
In VB, what coding could I use to calculate the 5th working day of every month? And if the 5th day is a holiday to go up one day.
...
I'm using .NET 2.0 Windows Forms and want to add "drawing" components such as lines, rectangles, etc.. I've done this before in MS Access, but I can't seem to find similar things in teh Visual Studio 2005 IDE. Where do I need to look to find these elements?
...
My VB.NET program currently takes a 4BPP TIFF as an Bitmap, converts it to a Graphic, adds some text strings and then saves it out again as a TIFF file. The output Bitmap.Save() TIFF file by default seems to be 24BPP (regardless of the input) and is a lot larger than the original TIFF.
Is it possible to keep the same 4BPP palette encodi...
I'm running CR XI, and accessing .RPT files through a ReportViewer in my ASP.NET pages.
I've already got the following code, which is supposed to set the Report Datasource dynamically.
rptSP = New ReportDocument
Dim rptPath As String = Request.QueryString("report")
rptSP.Load(rptPath.ToString, 0)
...
VB.NET 2.0 Framework
I developed a control that implements IExtenderProvider in order to attach to controls and display a form for translating of the text of that control. This works great on regular controls on the form but the IExtenderProvider is not attaching to controls on UserControls by default.
Is it possible to modify the Use...
I am working with the office interop and am having trouble inserting page breaks in excel. My code is working fine with the horizontal page break but I also need to set the vertical pagebreak
My code is below can someone modify it to make a vertical page break on column "I" this code is making the correct horizontal pagebreak but is sti...
Public Class HighlightKey
Inherits Control
Private m_fillColor As Color = Color.White
Private m_opacity As Integer = 100
Private alpha As Integer
Private m_image As Image
Public Sub New()
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
SetStyle(ControlStyles.Opaque, True)
Me.Ba...
I have a VB.NET form with a red background and white text. I want to change the opacity of the background (not the text) to 50%; how would I go about accomplishing that?
...
I created a control in LabView. My LabView code writes data of that type to a binary file. I want to read this data into a VB Structure.
Can I do this programmatically, or do I need to manually create a corresponding structure?
...
Hi all,
This is hopefully a softball syntax question: I need to call a method with an empty Object array for evaluation and set initial state. In C# I would just do this:
func(new Object[]{});
In VB.NET I am forced to do this:
Dim ctrls() As Control = {}
func(ctrls)
Is there a way to shorthand the call in VB.NET and have everythi...
I need ability to display content in Hex View, like this from WinHex
Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F
00000000 EF BB BF 0D 0A 4D 69 63 72 6F 73 6F 66 74 20 56 ..Microsoft V
00000010 69 73 75 61 6C 20 53 74 75 64 69 6F 20 53 6F 6C isual Studio Sol
00000020 75 74 69 6F 6E 20 46 69 6C 65 2C 20 46 ...
I am monitoring Notepad activities. I want the character that gets deleted when we press backspace or delete.
In addition, I don't want to modify the existing clipboard contents.
...