
CJLeit
Avatar/Signature-
Posts
33 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by CJLeit
-
Well it turns out the focus works when I run it from my real web server but now when I'm running it in debug mode from Visual Studio. Is there something I need to set on the debug server visual studio uses to fix this.
-
I am using Visual Studio 2005 and I'm having a problem getting the DefaultFocus property of a form to work. I made a very simple page to test and it still didn't set focus to my text box. Am I doing something wrong? <body> <form id="form1" runat="server" defaultfocus="TextBox1"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></div> </form> </body> Thanks, chuck
-
I'm calling a table adapter fill method to fill a dataset that is bound to a datagrid. The fill method has a parameter for an order id. The order id is set when the user picks it from a drop down list. When they pick a different id from the list I want to refresh the grid to show the new data. Right now I'm doing a complete refill of the dataset. Is there a way to just call a refresh on the table adapter to refresh the data without doing a full refill? Thanks!
-
Thanks, I think the MustInherit is what I was looking for on the first questions. On the second example right now I just have them passing an object as the parameter. Is there a way to make sure that object implements a certain interface.
-
I have 2 quick questions about interface implementation. 1. Is there a way to require someone to implement a certain interface if they inherit from my base class? 2. I have a function that the user passes a class to as a parameter. Is there a way to make sure that that the passed class implements a certain class similar to what you can do with generic functions? Thanks!
-
Thank you very much! You second example was exactly what I was looking for.
-
I have an application that has to run a test on a piece off eqipment based on 12 time intervals stored in a database. I have the app working but it seems like there must be a better way to do it. Below is a simplified version of what I have now. I would like to have one event handler handle all the timers but the problem is I need to know which timer called the event so I can updated the correct row in the database. Any suggestion would be appreciated. Public Class frmMain Dim con As New SqlConnection(My.Settings.conString) Dim WithEvents timer1 As New System.Timers.Timer Dim WithEvents timer2 As New System.Timers.Timer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim intervalsCommand As New SqlCommand("SELECT * FROM reponse_intervals ORDER BY minutes", con) Dim intervals As SqlClient.SqlDataReader Dim loopCounter As Int16 = 1 Using con con.Open() intervals = intervalsCommand.ExecuteReader Do While intervals.Read If intervals.Item(0) <> "0" Then timers(loopCounter).Interval = intervals.Item(0) End If Loop End Using End Sub Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click timer1.start timer2.start End Sub Private Sub test(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles timer1.Elapsed UpdateDBRow(1, ReadSensor) End Sub Private Sub test(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles timer1.Elapsed UpdateDBRow(2, ReadSensor) End Sub End Class
-
Unfortunetly for this project I have to use VS 2003 or else I would try the Using function. Thanks for your reply!
-
Hello, I have a database connection that I'm closing in the finally section of my error trapping. The problem is sometimes an error occurs before the connection is open so when it hits the finally the connection.close line causes another error to happen. Is there an easy way to ignore errors in the finally section of my error trapping? Thanks!
-
Why with some function do I have to use an AddHandler statment but with other I can create a function and use the handles statement? For example with the format event of a bound control you use the below statement but there is no way I know of to make a sub and use the Handles keywork. AddHandler textBox.DataBindings("Text").Format, AddressOf FormatName Thanks!
-
The only problem I have using an interface is that some of the classes may have properties that are unique to them that I wouldn't include in the intefece. In that case would the following code be the correct way to access those properties? Thanks! Public obj As intTest Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click obj = New Test [b]CType(obj, Test).sampleProperty = "hello"[/b] AddHandler obj.testEvent, AddressOf testEvent End Sub
-
Below is a sample of some code I am working with. I need to be able to declare a class as a generic object because I will load a different class based on some user selection. The code works OK but I wondering if there is a way to use the AddHandler without having to convert my object every time. If I don't put in the CType I can't compile because it tells me sampleEvent is not an event of 'Object'. I can access all my properties and methods just fine without using the CType each time but not my events. Any suggestions? Public obj As Object Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load obj = New Test obj = cType(obj, Test) AddHandler [b]CType(obj, Test).sampleEvent[/b], AddressOf junk obj.sampleProperty = "hello" End Sub
-
I've got the below line of code in my program that checks if the program is running in Debug mode. #If DEBUG Then msgbox(idNum) #End If If I compile in debug mode and run the program it gives me my message box. However if I have release mode selected in the configuration manager and then run the program from the IDE I don't get my message. I figured that whenever you ran a progrom from the IDE it would automaitcally be considered to be in debug mode, is this incorrect? If so is there a way to tell if you're running from the IDE. Also I rarely use debug checks like this in my programs. Is there any point to ever be in debug mode if you don't use any debug symbols? Thanks!
-
I have a combo box that I want to loop through all of the items in it and if the string returned from a function is in the list items I want to set the text to that string. I found a way to do it but it seems like there must be a better way to do it. Here is the way I'm currently doing it. Head is the string returned from my function. Any suggestions? For Each row As System.Data.DataRowView In cboHead.Items If (row.Row.Item(0).ToString) = head Then cboHeadead.Text = head Exit For End If Next
-
I have a textbox that I set the EnableViewState property to false. The problem is that it is holding it's state after postbacks. I have other controls that I do this for and they work fine. How can I make it so my textbox doesn't hold it's state after postbacks? Thanks!
-
I'm modifying an existing .net website and in the HTML the previous developer using <%# Function Name %> several times in his HTML to call a function and return the value to the screen. I've always used <%= Function Name %>to do the same thing. Is there a difference in the 2 methods of doing this? Thanks!
-
Hello, I'm trying to format a simple table in an .aspx page and it's giving me some problems. All I want is a 3 row table. The first 2 rows will always be the same height the 3rd row will fill up the rest of the page. If I take out the <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> line at the top of my .ASPX page I can get this to work. If I put that line back in it stops working. What are the repercussions of removing this line? Second question. My table looks fine in IE but in FireFox the scroll bar shows up and there are a couple inches of empty space. What am I doing wrong that is causing this. I've pasted a simplified version of what I'm trying to do. Any help would be appreciated! <table border="1" width="100%" id="table1" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="100%" runat="server"> <tr> <td valign="top"> <table border="1" width="100%" id="table2" height="126"> <tr> <td bgcolor="#000000"> </td> </tr> </table> <table border="1" width="100%" id="table3" height="30"> <tr> <td> </td> </tr> </table> <table border="1" width="100%" id="table4" height="100%"> <tr> <td width="192" nowrap valign="top" bgcolor="#FFDD48"> </td> <td valign="top">test<br /><br /><br />Test 2</td> </tr> </table> </td> </tr> </table>
-
Thanks, that's exactly what I needed!
-
Hello, I am making a function for a class and I wantone of the parameters of the class to only allow certain selections in the intellisense. Basically what I want is similar to how when a function expects a drawing.color it gives you an intellisense list of all the available colors. What do I need to do to make this happen. I've tried making a custom structure and using that as the type for my parameter but that didn't work. Any ideas? Thanks!!
-
Hello, I have a field in a database that contains text with HTML formatting included. How can I get a label or textbox to display the formatting instead of the actual HTML tag. For example my record contains '<B>Catalog</B>'. How can I get it to bold the world catalog instead of just printing out my tags? Thanks!
-
They are essentially the same webservice just looking at a different URLs. Is there an easy way in code to chage the app.config to look at different URL's? Thanks!
-
Hello, I have a project that calls a web services but it needs to call a different version of the service based on the environment I'm working in. I have this working with the code sample below but doing it this way I lose the intellisense for the web service. Is there a way to do late binding and still use intellisense? Dim wsVendPart As Object If bTestEnviornment = False Then wsVendPart = New VendPart.VendPartServiceWse Else wsVendPart = New VendPartTest.VendPartServiceWse End If
-
I think setting it so accessing the ControlsCollection throws an error will do what I need it too. However I do access the collection in my user control. So now it throws that exception when I try and access the collection in my control. Is there a way to tell if the procedure was called from within my class or from an external class? Thanks!
-
I have a UserControl that consist of several other controls. I want to make sure any changes that are made to the controls are done through my class. The problem is I can go through the Controls Collection of my UserControl and modify them that way. Is there a way to make the Controls Collection of a UserControl read only? Thanks!