Search Results

Search found 4472 results on 179 pages for 'vb'.

Page 99/179 | < Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >

  • A potentially dangerous Request.Form value was detected: Dealing with these errors proactively, or a

    - by Albert
    I'm noticing this error more and more in my error logs. I've read through the questions here talking about this error, but they don't address what I would like to do (see below). I'm considering three options, in the order of preference: 1) When submitting a form (I use formviews almost exclusively, if that helps), if potentially dangerous characters are detected, automatically strip them out and submit. 2) When submitting a form, if potentially dangerous characters are detected, alert the user and let them fix it before trying again. 3) After the exception is generated, deal with it and alert the user. I'm hoping one of the first two options might be able to do somewhat globally...I know for the 3rd I'd have to alter a TON of Try-Catch blocks I already have in place. Doable, but labor intensive. I'd rather be proactive about it if at all possible and avoid the exception all together. Perhaps one approach to #1 would be to write a block of code that could loop through all text entry fields in a formview, during the insert/update event, and strip the characters out. I'm ok with that, but I'd rather not have to heavily alter all my Insert/Update events to accomplish this. Or maybe I just create a different class to do the text checking/deleting, and only insert 1 line of code in each Insert/Update event. If anyone can come up with some example code of any of these approaches that would be a help. Thanks for any ideas or information. I'm definitely open to other solutions too; these are only the 3 that came to mind. I can say that I don't want to turn request validation off though.

    Read the article

  • Dynamically create textbox

    - by comii
    I need to dynamically create textbox. This is my code, but with this I create only one textbox: Public Sub CreateTextBox() Dim I As Integer Dim niz As Array For I = 1 To 5 Dim myTextBox = New TextBox myTextBox.Text = "Control Number:" & I Me.Controls.Add(myTextBox) Next End Sub So how i can dynamically create textbox? Thanks!

    Read the article

  • WPF: How to programmatically utilize the ErrorTemplate of an Control?

    - by geeraija
    Hi, is there a way to programmatically set and remove the ErrorTemplate of an Control without the whole Validation mechanism? Basically, what I'd like to do, is to retrieve the ErrorTemplate of an Control at some point like this: ControlTemplate errTemplate = Validation.GetErrorTemplate(myTxtBx); and temporarily use it as it's ControlTemplate like this: myTxtBx.Template = errTemplate; Can you somehow do this?

    Read the article

  • DateTime Format Strings?

    - by Phil
    I have the date format string dd-mm-yy. Please can you tell me how to add hours and minutes to the string (i.e 13-03-2010.21.03) .... DateTime.Today.ToString("dd-mm-yy") ?

    Read the article

  • Fast serarch of 2 dimensional array

    - by Tim
    I need a method of quickly searching a large 2 dimensional array. I extract the array from Excel, so 1 dimension represents the rows and the second the columns. I wish to obtain a list of the rows where the columns match certain criteria. I need to know the row number (or index of the array). For example, if I extract a range from excel. I may need to find all rows where column A =”dog” and column B = 7 and column J “a”. I only know which columns and which value to find at run time, so I can’t hard code the column index. I could use a simple loop, but is this efficient ? I need to run it several thousand times, searching for different criteria each time. For r As Integer = 0 To UBound(myArray, 0) - 1 match = True For c = 0 To UBound(myArray, 1) - 1 If not doesValueMeetCriteria(myarray(r,c) then match = False Exit For End If Next If match Then addRowToMatchedRows(r) Next The doesValueMeetCriteria function is a simple function that checks the value of the array element against the query requirement. e.g. Column A = dog etc. Is it more effiecent to create a datatable from the array and use the .select method ? Can I use Linq in some way ? Perhaps some form of dictionary or hashtable ? Or is the simple loop the most effiecent ? Your suggestions are most welcome.

    Read the article

  • What is the preferred method of refreshing a combo box when the data changes?

    - by Craig Johnston
    What is the preferred method of refreshing a combo box when the data changes? If a form is open and the combo box data is already loaded, how do you refresh the contents of the combo box without the form having to be closed and reloaded? Do you have to do something on the Click event on the combo box? This would seem to be a potential slow down for the app if there is a hit to the database every time someone clicks on a combo box.

    Read the article

  • Parse multiple named command line parameters

    - by scholzr
    I need to add the ability to a program to accept multiple named parameters when opening the program via the command line. i.e. program.exe /param1=value /param2=value and then be able to utilize these parameters as variables in the program. I have found a couple of ways to accomplish pieces of this, but can't seem to figure out how to put it all together. I have been able to pass one named parameter and recover it using the code below, and while I could duplicate it for every possible named parameter, I know that can't be the preffered way to do this. Dim inputArgument As String = "/input=" Dim inputName As String = "" For Each s As String In My.Application.CommandLineArgs If s.ToLower.StartsWith(inputArgument) Then inputName = s.Remove(0, inputArgument.Length) End If Next Alternatively, I can get multiple unnamed parameters from the command line using My.Application.CommandLineArgs But this requires that the parameters all be passed in the same order/format each time. I need to be able to pass a random subset of parameters each time. Ultimately, what I would like to be able to do, is separate each argument and value, and load it into a multidimentional array for later use. I know that I could find a way to do this by separating the string at the "=" and stripping the "/", but as I am somewhat new to this, I wanted to see if there was a "preffered" way for dealing with multiple named parameters?

    Read the article

  • string parse and replace in for loop

    - by reffer
    i have a string that looks like this - "1AL||9CA||34CO||196WY||..." i want to use a for loop or while loop, in which if i have an integer, it should parse this string and delete the value matching that integer. example for above string string = "1AL||9CA||34CO||196WY||..." integer = 34 for ... loop new string = "1AL||9CA||196WY||..." As you can see the integer matched the integer 34 and deleted from one delimeter "||" to th next one. how can i do this?

    Read the article

  • Optimize LINQ Query for use with jQuery Autocomplete

    - by rockinthesixstring
    I'm working on building an HTTPHandler that will serve up plain text for use with jQuery Autocomplete. I have it working now except for when I insert the first bit of text it does not take me to the right portion of the alphabet. Example: If I enter Ne my drop down returns Nlabama Arkansas Notice the "N" from Ne and the "labama" from "Alabama" As I type the third character New, then the jQuery returns the "N" section of the results. My current code looks like this Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest ' the page contenttype is plain text' HttpContext.Current.Response.ContentType = "text/plain" ' store the querystring as a variable' Dim qs As Nullable(Of Integer) = Integer.TryParse(HttpContext.Current.Request.QueryString("ID"), Nothing) ' use the RegionsDataContext' Using RegionDC As New DAL.RegionsDataContext 'create a (q)uery variable' Dim q As Object ' if the querystring PID is not blank' ' then we want to return results based on the PID' If Not qs Is Nothing Then ' that fit within the Parent ID' q = (From r In RegionDC.bt_Regions _ Where r.PID = qs _ Select r.Region).ToArray ' now we loop through the array' ' and write out the ressults' For Each item In q HttpContext.Current.Response.Write(item & vbCrLf) Next End If End Using End Sub So where I'm at now is the fact that I stumbled on the "Part" portion of the Autocomplete method whereby I should only return information that is contained within the Part. My question is, how would I implement this concept into my HTTPHandler without doing a fresh SQLQuery on every character change? IE: I do the SQL Query on the QueryString("ID"), and then on every subsequent load of the same ID, we just filter down the "Part". http://www.example.com/ReturnRegions.axd?ID=[someID]&Part=[string]

    Read the article

  • iTextSharp Overlay Image

    - by pennylane
    Hi guys I have an instance where I have a logo image as part of some artwork.. If a user uploads a new logo I have a form field which is larger than the default logo. I then use that form field to position the new image. The problem is I need to set the background colour of that form field to white so that it covers the old logo in the event that the new image is smaller than the old logo.. what I have done is: foreach (var imageField in imageReplacements) { fields.SetFieldProperty(imageField.Key, "bgcolor", iTextSharp.text.Color.WHITE, null); fields.RegenerateField(imageField.Key); PdfContentByte overContent = stamper.GetOverContent(imageField.Value.PageNumber); float[] logoArea = fields.GetFieldPositions(imageField.Key); if (logoArea != null) { iTextSharp.text.Rectangle logoRect = new iTextSharp.text.Rectangle(logoArea[1], logoArea[2], logoArea[3], logoArea[4]); var logo = iTextSharp.text.Image.GetInstance(imageField.Value.Location); if (logo.Width >= logoRect.Width || logo.Height >= logoRect.Height) { logo.ScaleToFit(logoRect.Width, logoRect.Height); } logo.Alignment = iTextSharp.text.Image.ALIGN_LEFT; logo.SetAbsolutePosition(logoRect.Left, logoArea[2] + (logoRect.Height - logo.ScaledHeight) / 2); // left: logoArea[3] - logo.ScaledWidth + (logoRect.Width - logo.ScaledWidth) / 2 overContent.AddImage(logo); } } The problem with this is that the background colour of the field is set to white and the image then doesn't appear.. i remove the SetFieldProperty and RegenerateField commands and the image replacement works fine.. is there a way to set a stacking order on layers?

    Read the article

  • the shema return by the new query differ from the base query

    - by sochandara
    I am working on class project which required to work with Windows Application and this issue occurred to me that i don understand how to solved it can anybody help please? I want to show the NATIONALITYNAME instead of showing NATIONALITYID in the grid view SELECT COACH.COACHID , COACH.COACHFIRSTNAME , COACH.COACHLASTNAME , NATIONALITY.NATIONALITY FROM COACH INNER JOIN NATIONALITY ON COACH.NATIONALITYID = NATIONALITY.NATIONALITYID Error Message: "The Schema returned by the new query differ from the base query"

    Read the article

  • How can I get an IObservable<T> in Rx from a "non-standard" event?

    - by Dan Tao
    Here's what I mean. Suppose I'm working with an API that exposes events, but these events do not follow the standard EventHandler or EventHandler<TEventArgs> signature. One event might look like this, for instance: Public Event Update(ByVal sender As BaseSubscription, ByVal e As BaseEvent) Now, typically, if I want to get an IObservable<TEventArgs> from an event, I can just do this: Dim updates = Observable.FromEvent(Of UpdateEventArgs)( _ target:=updateSource, _ eventName:="Update" _ ) But this doesn't work, because the Update event is not an EventHandler<UpdateEventArgs> -- in fact, there is no UpdateEventArgs -- it's basically just its own thing. Obviously, I could define my own class deriving from EventArgs (i.e., UpdateEventArgs), write another class to wrap the object providing the Update event, give the wrapper class its own Update event that is an EventHandler<UpdateEventArgs>, and get an IObservable<UpdateEventArgs> from that. But that's an annoying amount of work. Is there some way to create an IObservable<[something]> from a "non-standard" event like this, or am I out of luck?

    Read the article

  • Problems migrating databinding in VB.NET from Winforms to ASP.NET 2.0

    - by David
    And this was supposed to be so easy... I have existing business and data access layers that handle the retrieval and update of the data in question. These work great with the existing Winforms application (.Net V2.0) Now, in trying to write a new web-based UI, I'm running into all sorts of problems (last time I wrote asp.net code was in 1.1). Specifically, I can't data bind a text box to a business object. Oh, sure there's the ObjectDataSource but that wants to know how to do CRUD operations on the data. What I'm looking for is something that acts like the 'classic' binding objects so that, in my code, it's as simple as retrieving the object and doing a a refresh. The data component like FormView and DetailsView are so generic-looking that it's ridiculous. The existing application would have tabbed dialogs, text boxes grouped by panels, etc. On top of that, I have a directive to use master pages and unless one control causes it, I can't seem to get the content section to expand. I can't just put a text box 'below' the bottom of "Content1" and have it resize the content section - which gives me the same results as an earlier question I posted when the footer wasn't being 'pushed down' - relative position solved that but doesn't seem to solve it with placing small text boxes in the area. What I want is fairly simple. Something like: bindingobject.datasource = businessdataobject bindingobject.refresh ...and have the text boxes refresh with the new values. Likewise to have 'businessdataobject' properties updated as the user enters new data. I was able to do this with the GridView (grdRequests.DataSource = lstRequests) by making a list of asp:BoundField tags inside the collection of the GridView. Am I tilting at windmills here?

    Read the article

  • How to implement a download for dynamic files in asp.net with masterpages

    - by Tim
    Hello, the title says it all. I have seen some similar questions on SO like this or this, but either i have overlooked something or my requirement is different, neither works. My situation is following: i have a Masterpage one of its contentpage is called MasterData.aspx MasterData has an asp.net ajax tabcontainer control with one usercontrol in every tabpanel these usercontrols(f.e. MD_Customer.ascx)hold the main content(like a normal page) they all have GridViews in it and i want to provide an Excel-Export-Button What i've tried is is to use an iframe like here. But the function that adds the iframe to the document gets never called and therefore i never see the save-as-dialog. Maybe this is caused by using a MasterPage. Does somebody has an idea on how to provide a button in an UpdatePanel that causes an async postback, so that i can generate a CSV dynamically in codebehind and write it to the response? Thank you in advance. aspx-markup: <asp:UpdatePanel ID="UpdGridInfo" runat="server" > <ContentTemplate> <asp:Label ID="LblInfo" Font-Underline="false" runat="server" CssClass="content" ></asp:Label>&nbsp;&nbsp; <asp:ImageButton ToolTip="export to Excel" style="vertical-align:bottom" ID="BtnExcelExport" ImageUrl="~/images/excel2007logo.png" runat="server" /> </ContentTemplate> </asp:UpdatePanel> and the BtnExportExcel codebehind handler(of course it cannot work to write the csv to the response of this page): Private Sub BtnExcelExport_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles BtnExcelExport.Click Dim csv As String = tableToCsv(DirectCast(Me.GridSource, DataTable)) Response.AddHeader("Content-disposition", "attachment; filename=RuleConfigurationFile.csv") Response.ContentType = "application/octet-stream" Response.Write(csv) Response.End() End Sub

    Read the article

  • Constructor within a constructor

    - by Chiramisu
    Is this a bad idea? Does calling a generic private constructor within a public constructor create multiple instances, or is this a valid way of initializing class variables? Private Class MyClass Dim _msg As String Sub New(ByVal name As String) Me.New() 'Do stuff End Sub Sub New(ByVal name As String, ByVal age As Integer) Me.New() 'Do stuff End Sub Private Sub New() 'Initializer constructor Me._msg = "Hello StackOverflow" 'Initialize other variables End Sub End Class

    Read the article

  • How to add a service to the type descriptor context of a property grid in .Net?

    - by Jules
    I have an app that allows the user to choose an image, at design time, either as a straight image, or from an image list. All cool so far, except that this is not happening from the visual studio property browser, its happening from a property grid that is a part of a type editor. My problem is, both the image picker (actually resource picker), and the imagelist type converter rely on some design-time services to get the job done. In the case of imagelist, its the IReferenceService and in the case of the resource picker its a service called _DTE. In the first instance of an edit from the visual studio property browser, I could get a reference to these services but (1) how can I add them to the type descriptor context of my property grid? It would be better, for future proofing, if I could just copy a reference to all of the services in the type descriptor context. (2) Where does the property browser get these services from in the first place? ETA: I still don't know how to do it, but I now know it is possible. (1) Sub-class control and add a property whose type is an array of buttons. (2) Add it to a form. (3) Select the new control on the design service and edit the new property in the property browser. (4) The collection editor dialog pops-up (5) Add a button (6) Edit image and image list - the type editor and type converter, respectively, behave as they should.

    Read the article

  • Retriving data from ListView control

    - by Josh
    I have a ListView control set up in details mode with 5 columns. It is populated by code using the following subroutine: For j = 0 To 14 cmd = New OleDbCommand("SELECT TeacherName, ClassSubject, BookingDate, BookingPeriod FROM " & SchemaTable.Rows(i)!TABLE_NAME.ToString() & " WHERE (((BookingDate)=" & Chr(34) & Date.Today.AddDays(j) & Chr(34) & ") AND ((UserName)=" & Chr(34) & user & Chr(34) & "));", cn) dr = cmd.ExecuteReader Dim itm As ListViewItem Dim itms(4) As String While dr.Read() itms(0) = dr(0) itms(1) = SchemaTable.Rows(i)!TABLE_NAME.ToString() itms(2) = dr(1) itms(3) = dr(2) itms(4) = dr(3) itm = New ListViewItem(itms) Manage.ManageList.Items.Add(itm) End While Next Note that this is not the full routine, just the bit that populated the grid. Now I need to retrieve data from the ListView control in order to delete a booking in my database. I used the following code to retrieve the content of each column: ManageList.SelectedItems(0).Text But it only seems to work on index 0. If I do: ManageList.SelectedItems(3).Text I get this error: InvalidArgument=Value of '3' is not valid for 'index'. Parameter name: index I'm pretty much stumped, it seems logical to me that index 1 will point to the 2nd column, index 2 to the 3rd etc, as it's 0 based? Any help would be appreciated, thanks.

    Read the article

  • Versioning issues with assemblies

    - by devoured elysium
    Let's assume I have two assemblies: MyExecutable.dll version 1.0.0 MyClassLibrary.dll version 1.0.0 Now, MyExecutable.dll currently uses MyClassLibrary.dll's classes and methods (which include some algorithms). Most of those algorithms were made on the run, being that later I'll want to refine them if needed. This means, I won't change the interface of those classes but the code itself will see some changes. The question at hand is, MyExecutable.dll will be expecting MyClassLibrary.dll 1.0.0 and I'll want it to use version 1.0.1 (or something like that). I don't want to have to recompile MyExecutable.dll(because actually there might be more than just one executable using MyClassLibrary.dll). Is there a solution for this problem? I've heard about the GAC, but if possible I'd like to stay away from it. Thanks

    Read the article

< Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >