
ballisticnylon
Avatar/Signature-
Posts
83 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by ballisticnylon
-
Container control adding properties to children
ballisticnylon replied to ballisticnylon's topic in Windows Forms
Re: IExtenderProvider Ah, great. Thanks. -
Hi there everybody, Today I was playing around with the Flow Layout Panel control (it's a panel that governs the layout of the controls it contains, moving their locations so controls don't overlap). Anyway, any control that is added to a Flow Layout Panel gets a new property, FlowBreak. I've noticed that this property is settable in the Property Grid in the designer, but not in code. I guess my (very general) question is, what's going on here? How does a parent control add a property to its' children, is it a real property that belongs to the child, and finally (and most importantly) how can I write a container control that does the same thing? Thanks in advance, people. This stuff is confusing. bn
-
I got it working with an asp textbox. Thanks for your help!
-
That's a good start. I could do something like that in javascript, and then execute that script inside an event handler. But I'm not trying to set the input's property, I'm trying to expose the input's value as a read-only property of the containing .ascx control. If I could execute the javascript in C# or VB.NET and have it return a value (most likely a string), that would be ideal.
-
Hi everyone, I'm making a simple user control that encapsulates some javascript that I found online (the javascript is a pop-up calendar that writes the selected date to an html input tag). The script will not work if runat="server" is added to the tag, nor will it work if I try to use a textbox instead. I'd like to be able to expose the selected date as a property of the control I'm making, but I'm having trouble finding a way to access the value of the input tag programatically. Any ideas?
-
Hello, Is there an accepted way to 'push' data to a client browser? In other words, to have the client recieve some data and update its' display without refreshing the page? I have a datagrid that I want to display some live data. I also have a webservice that exposes the data in question. Currently the client browser consumes that webservice once per second and updates its' datagrid. but this strikes me as horribly inefficient. I was just wondering if there's a standard practice for going about such a thing. Any help greatly appreciated.
-
Select vs. If/elseif statements for determining type
ballisticnylon replied to ballisticnylon's topic in General
Wow. So the idea behind an interface is that any of my classes can implement it, and I won't have to detect the type at all, I just pass in the interface. I thank you for causing an a-ha moment. I gotta learn more about this stuff. But I want to ask, was there something wrong or inefficient about detecting the type of a passed object? Why is what you're describing better? It would seem to me that (in your example code) every class that implements ICityProvider and has the comment "really return a list of cities for X" would be repeating a lot of code from the other classes. The whole point of having a recursive sub was to reuse that logic. -
Select vs. If/elseif statements for determining type
ballisticnylon replied to ballisticnylon's topic in General
Basically, I have defined a nested class structure (things within things within things). Then I have a recursive sub that determines the type of object that gets passed in and calls itself for each object that the passed object contains. The following code fills _Cities with all the cities contained by the passed object, whether it's the world, a country, state, or county. Private _Cities as CityCollection Private Sub GetAllCities(ByVal O as object) Select Case O.GetType.Name Case "World" For each cntry as Country in directcast(O, World).Countries GetAllCities(cntry) Next Case "Country" For each s as State in directcast(O, Country).States GetAllCities(s) Next Case "State" For each co as County in directcast(O, State).Counties GetAllCities(co) Next Case "County" For Each c as City in directcast(O, County).Cities _Cities.add(c) Next Case "City" _Cities.Add(directcast(O, City)) End Select End Sub Select Case O.GetType.Name feels like a klooge, though. -
Let's say that I have a function that gets passed in an object, and deals with it according to it's type. Which is the better way? Private Sub DoSomething(ByVal O as Object) If TypeOf(O) Is apple Then ' do something ElseIf TypeOf(O) Is orange Then ' do something else End If End Sub or Private Sub DoSomething(ByVal O as Object) Select Case O.GetType.Name Case "apple" ' do something Case "orange" ' do something else End Select End Sub For some reason, you can't do Select Case O.GetType.
-
I'm trying to write a simple color-picker that will run in a browser. So far I've got a dropDownList populated with the names of known colors. I'd like to have each ListItem also have a small box filled with the appropriate color. I know how to do this in a Windows Forms environment, but I'm at a loss as to how to accomplish the same thing in ASP.NET. Has anyone out there ever done anything similar to this?
-
I want to have my application play a .wav file, but I don't want to have to install that .wav file to a place where the user could have access to/move it. Has anyone out there already found a way to embed a .wav file in the .exe, and then summon it up and play it? 8000+ classes and I have to wrap an API to play a sound. An oversight if you ask me. I want something like System.Media.Wav.Play!!! I must be spoiled. :rolleyes:
-
I think it's System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream
-
you wouldn't really be adding items, just concatenating additional text. Textbox1.Text = "Thing1" Textbox1.Text &= " Thing2" Is that all you meant?
-
Adding a progress bar to a status bar
ballisticnylon replied to wessamzeidan's topic in Windows Forms
Dim pbr As New ProgressBar Me.StatusBar1.Controls.Add(pbr) -
You could just have a boolean flag called movingRight, and then use that to determine how to move your button. Why don't you post what you have so far, and maybe someone will be able to help you.
-
I think the good outweighs the bad...
-
Is it indenting and coloring and stuff, oh my? Public Function ConvertToDecimal(ByVal V As String) As Double If V.IndexOf("/") = -1 Then Return V End If Dim Whole As Integer = CInt(V.Substring(0, V.IndexOf(" "))) Dim N As Integer = CInt(V.Substring(V.LastIndexOf(" ") + 1, (V.IndexOf("/") - V.IndexOf(" ") - 1))) Dim D As Integer = CInt(V.Substring(V.IndexOf("/") + 1, (V.Length - V.IndexOf("/") - 1))) Return Whole + (N / D) End Function No, it's not. Being able to see code as you would in Visual studio is more important than the look and feel of the site.. Just make sure that code is readable. But I'm sure they'll iron out the wrinkles.
-
Transparent Background of a picture
ballisticnylon replied to ToniMontana's topic in Graphics and Multimedia
Bitmap objects have a MakeTransparent method that you pass a color. It results in every pixel that is that color being transparent... Dim bmp as new Bitmap("C:\testImage.bmp") bmp.MakeTransparent(Color.Cyan) PictureBox1.Image = bmp -
Cool. And it works for multiple keys, like you said: Dim WKeydown As Boolean Dim QKeyDown As Boolean Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyData = Keys.W Then WKeydown = True If e.KeyData = Keys.Q Then QKeyDown = True RefreshLabels() End Sub Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp If e.KeyData = Keys.W Then WKeydown = False If e.KeyData = Keys.Q Then QKeyDown = False RefreshLabels() End Sub Sub RefreshLabels() If WKeydown Then lblW.Text = "W" Else lblW.Text = "" If QKeyDown Then lblQ.Text = "Q" Else lblQ.Text = "" End Sub Thanks for the trick.
-
I must be missing something. Take this code for example: Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown Debug.Write(e.KeyData.ToString) End Sub Now lets say I press and hold 'Q'. The debug window fills in with 'Q"s. Now let's say that, while still holding down 'Q', I press and hold down 'W'. Our debug window starts writing 'W''s instead of 'Q''s. The event arguments for the KeyDown event only tell us about the 'W'. And now when I release the 'W' key, the event stops firing altogether, even though I'm still holding down 'Q'. Cool avatar, btw.
-
I wonder if there would be a way to have a font be an embedded resource, and then summon it as a stream. Probably not... EDIT: nope.
-
I'm up a certain creek without a certain paddle, and I'm hoping someone can help. Here's the situation: I've built a relational database in Access, where there's a one-to-many relationship between two tables. I have a table, and it's primary key is auto incrementing (meaning the database is supposed to assign a unique value for the primary key for each row when a new row is added). The only problem is that when I build my dataset (the one I'll be adding rows to), I'm only pulling certain rows from the database. Which is fine until I want to add a new row. As far as I can tell, the only way to get the assigned value for my new row's primary key is to get the value back from the function that adds all the column values in one line: Dim thePrimaryKeyOfTheRowIJustAdded as Integer = MyDataSet.MyTable.AddMyTableRow(a, b, c, d, e) ...which returns the sought-after primary key of the row I just added. But the problem is this: The dataset isn't populated with every record, but with records specified by a WHERE clause. So not every record that was in the original database is in the dataset that I created. It appears that a value for the primary key is being assigned that is NOT unique to the database that my dataset was built from. In other words, buh-bye data integrity. Do I actually have to build a dataset that contains every record so that when I add a row, the primary key will be unique? Or am I missing something? Please tell me I'm missing something!
-
Dim img As Image = Image.FromFile("C:/whatever")