mike55
Avatar/Signature-
Posts
734 -
Joined
-
Last visited
About mike55
- Birthday 05/27/1982
Personal Information
-
Occupation
Software Developer/Engineer
-
Visual Studio .NET Version
Visual Studio.Net Professional 2005
-
.NET Preferred Language
VB.net, C#
mike55's Achievements
Newbie (1/14)
0
Reputation
-
Good morning all, We have a procedure that requires us to validate all input for text fields; if the input contains certain characters or key words, we must force the user to re-enter alternative data. Some of the characters that we look for at the start of sentances are: ' ; / > -- < admin @ declare = Some of the characters that we look for at the end of sentances are: one > The keywords that we look for are: @@ xss __ (double underscore) NULL varchar ‘’ (double single quote) ascii '; cursor exec (followed by space) -- char( src I have added the regular expression validator to my web page and have entered the following custom validator: The validator does not fire for any of my illegal characters, how can I set the above custom validator to "not equals"? I know that I can use the Regex.IsMatch function within the code, but thought that by using the regular expression control may be safer. Mike55.
-
I am using a number of calendar extenders on a page. the layout that I am using is as follows: <div class="myDiv"> <label>Date Rescinded</label> <asp:TextBox ID="txtBNRescinded" runat="server" CssClass="FormItemStyle" ValidationGroup="view2" Width="90px"> </asp:TextBox> <asp:ImageButton ID="iBtnBNRescinded" runat="server" ImageUrl="~/Images/Calendar_scheduleHS.png" /> </div> The css that I am using is: .myDiv { text-align: left; } label { float: left; text-align: left; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 0.9em; font-style: normal; color: #000000; width: 17em; padding-left: 6px; padding-right: 6px; } p { text-align: left; height:2em; } When I click on the button, the calendar appears as per normal. However, when I go to select a date, the entire controls goes blank and then disappears. Any suggestions? I have tried to enclose the whole thing within a <p> tag. However, this only results in a javascript errors: "Object required". Mike55.
-
Solution: Private Sub ReloadSelectionCriteria(ByVal userSelection As Hashtable, ByVal parent As Object) Dim myC() As Control For Each entry As DictionaryEntry In userSelection myC = parent.Controls.Find(entry.Key.ToString, True) CType(myC(0), ComboBox).SelectedIndex = entry.Value Next End Sub
-
Fixed my initial problem: Private Sub ReloadSelectionCriteria(ByVal userSelection As Hashtable, ByVal parent As Object) Dim myC() As Control For Each entry As DictionaryEntry In userSelection myC = Controls.Find(entry.Key.ToString, True) CType(myC(0), ComboBox).SelectedIndex = entry.Value Next End Sub I now have an additional issue, the form that I am using is an instance of the parent form and both of them remain open on screen. When I cycle through the hashtable, the above code is simply looking at the parent form. How can I re-target it at the child form? Mike55.
-
Hi I am using the following code: Private Sub ReloadSelectionCriteria(ByVal userSelection As Hashtable) For Each entry As DictionaryEntry In userSelection CType(Controls(entry.Key), ComboBox).SelectedItem = entry.Value Next End Sub to loop through all the keys in a hash table. All the keys are the names of a valid combobox displayed on screen. What I am trying to do is to reflect the values chosen on the comboboxes on the parent screen through to the child screen. However, with the above code I am getting a NullReferenceException. Any suggestions? I believe that the problem is that my code cannot find the control on the windows form. Mike55.
-
1. XMLWriterTraceListener 2. TextWriterTraceListener 3. DefaultWriterTraceListener Ok, I am going through the MCTS book for exam 70-536, I am currently looking at chapter 10, lesson 2 "Debugging and Tracing". The lesson talks about using Trace listeners and how they can be implemented using either code or in the .config file. I have a basic web application, so I have tried to implement the XMLWriterTraceListener in my web.config. I would intend to try out the other 2 listeners also. Now, to apply the changes to the config file only, the following changes need to be made: <system.diagnostics> <trace autoflush="true" indentsize="5"> <listeners> <add name="xyz" type="System.Diagnostics.XMLWriterTraceListener" initializeData="output.xml"/> <remove name="Default"/> </listeners> </trace> </system.diagnostics> The alternative approach is to do the following in code: Trace.Listeners.Clear() Trace.Listeners.Add(New XMLWriterTraceListener("C:\output.xml")) Trace.Autoflush = True Trace.WriteLine("This is a Test") None of the above two code segments worked for me in my web application, for the second code segment, I got an error message: "Listeners is not a member of System.Web.TraceContext". I then switched my two code segments to a sample windows application. The changes to the app.config coupled with the line: Trace.WriteLine("hello world...") did not appear to work. When I used the second code segment (having removed the changes from the config file), the tracing worked. Have I missed something with regards to the app.config file? Should the changes to the app.config file have worked in my web project? Mike55.
-
Hi all I have a dateset whose contents can be changed by the user. Usually the user would click the save button when they are finished making the changes. However, if they forget to click on the save button, I want to simply offer them the opportunity to do so when the FormClosing event is fired. Here is my code so far: Private Sub frmGeneralQueries_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Select Case mintReport Case frmMain.mcTotalByOrganisation If Not dsPRTRDisplay.Tables("TotalByOrganisation").GetChanges.Rows.Count = 0 Then If MessageBox.Show("Your changes have not been saved. Do you want to Save them?", "Save Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then AllowSaveChanges() End If End If End Select End Sub The above code works in the event that there was a change that the user had not already save, however, I am getting problems if no changes exist. I know that I could use dataset.haschanges, however, there is no guarantee that the dataset in question would only have one table in it. Error message is: NullReferenceException - Object Reference not set to an instance of an object. Any suggestions? Mike55.
-
Need the extra columns as they contain timestamp and audit details. One of the columns that I bring back is binded to DataGridViewComboBoxColumn that contains three values. When the value is changed, I need to timestamp it and record what user made the changes. The user can then hit a save button that transports the updated dataset to the backend and calls the dataadapter.update method thus updating the database.
-
I am binding a dataset to a datagridview. My dataset returns about 7 different columns, of which I only want 3 to be visible. To enable me to hide the additional columns, I have added the following code: 'Organisation Name dCol.HeaderText = "Organisation Name" dCol.Name = "OrganisationName" dCol.DataPropertyName = "OrganisationName" dCol.ReadOnly = True dgvResults.Columns.Add(dCol) 'License Code dCol = New DataGridViewTextBoxColumn dCol.HeaderText = "License Code" dCol.Name = "LicenseCode" dCol.DataPropertyName = "LicenseCode" dCol.ReadOnly = True dgvResults.Columns.Add(dCol) 'Total Waste/Emissions dCol = New DataGridViewTextBoxColumn dCol.HeaderText = "Total Waste/Emissions" dCol.Name = "Total" dCol.DataPropertyName = "Total" dCol.ReadOnly = True dCol.Visible = false dgvResults.Columns.Add(dCol) I then have a refresh button that allows me to retrieve a new version of the data and automatically binds the data to the datagridview control. The problem is that some of the columns that I have specified as Visible=false are showing up. Any suggestions on how I can check if the column already exists or simply delete the column in question? Mike55.
-
Hi I have a datagridview control on my form, into that grid I add a number of columns depending on the data I want to display. The majority of the columns are: DataGridViewTextBoxColumn, however there are a number of DataGridViewComboBoxColumn to be added. The DataGridViewComboBoxColumn will have 3 option: "Not Done", "Satisfactory", and "Not Satisfactory". I want to add an eventhandler that is fired when any of the cells in the column have there data changed by the user. My reasoning is that I must save the change to the database at some stage. Can anyone suggest what eventhandler I should be adding? Mike55.
-
Application.EnableVisualStyles works for the majority of the control. Will play around with it and see how it works out. Mike55. Note: Just after finding the exact solution, go to the main project and look at its properties window. Under the application tab there is a checkbox "Enable Application Framework", this needs to be checked. Once checked, this will enable the "Windows Application Framework properties" which will allow you to check the checkbox "Enable XP visual styles". Mike55.
-
I'd say both; for example when you view the converted windows form in the designer, buttons have that rounded effect/presentation and the default tab control has an xp type colour style. However, when I run the application, the buttons and tab control are presented as if they were still in .net framework 1.1. Mike55.
-
Hi I have upgraded a windows application to .NET Framework 2.0. When I look in the designer the GUI Theme appears correctly, however, when I run the application the GUI Theme from .NET Framework 1.1 is used. Is there anyway I can have the 2.0 Framework used at all times? Mike55.
-
I have the following SQL statement: SELECT tbMeasurement.MonitoredEntityCode, CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_1' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_1' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_2' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_2' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_3' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_3' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_4' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_4' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_5' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_5' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_6' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_6' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_7' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_7' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_8' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_8' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'EMISSION_POINT_9' THEN tbMeasurement.NumericResult END AS 'EMISSION_POINT_9' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'FUGITIVE_TOTAL' THEN tbMeasurement.NumericResult END AS 'FUGITIVE_TOTAL' ,CASE WHEN tbMeasurement.MonitoredLocationCode = 'ACCIDENTAL_TOTAL' THEN tbMeasurement.NumericResult END AS 'ACCIDENTAL TOTAL', tbMeasurement.SampleID, tbMeasurement.ParameterCode, tbParameter.ParameterDescription, tbMeasurementExtraData.M_C_E, tbMeasurementExtraData.MethodCode, tbMeasurementExtraData.Description FROM (tbMeasurement INNER JOIN tbParameter ON tbMeasurement.ParameterCode = tbParameter.ParameterCode) INNER JOIN tbMeasurementExtraData ON (tbMeasurement.ParameterCode = tbMeasurementExtraData.ParameterCode) AND (tbMeasurement.SampleID = tbMeasurementExtraData.SampleID) AND (tbMeasurement.MonitoredLocationCode = tbMeasurementExtraData.MonitoredLocationCode) AND (tbMeasurement.MonitoredEntityCode = tbMeasurementExtraData.MonitoredEntityCode) As you can see I as using a Case statement to create a new column for each type of emission point found and for Fugitive and Accidental Totals. What I am also trying to do is to replace the null values returned for Fugitive and Accidental Totals with a 0. I have tried using an inner case statement but that doesn't seem to work, any suggestions? I have also tried the replace statement, no effect. Mike55.
-
Solved the problem, it would appear that I must register the name of the "CustomKey" rather than the Key name. Mike55.