|
The example isn't perfect -- I don't even think it's correct syntax (the type placeholder T isn't defined at class scope). Perhaps it would behoove you to do a little research on reflection and generics, in part to solve your property problem and in part to learn two powerful features of .NET.
|
# ? Feb 28, 2007 20:37 |
|
|
# ? Jun 10, 2024 12:22 |
|
Ok. I have a .NET (in C#) service that needs to make connection to a projector through TCP. It serves as a back end to a GUI. Reason why it is this way is because I need the GUI to show up just under the login prompt. The idea is that anyone can use the projector w/o having the need to log in to the machine (say to play a DVD). The service is set to start automatically. The problem: I keep getting System.IO.IOException: System unable to write data to the transport connection: an existing connection was forcibly closed by the remote host. Now here's the kicker. If I login to the machine and kill the service and then turn it back on, everything runs hunky dory. I can turn the drat thing on/off and what not. And it works for every single subsequent login/logout until the next reboot. Here's the code that throws the exception. code:
|
# ? Mar 1, 2007 01:34 |
|
How do I create a 'compact' textbox? (As seen in the search box in firefox) I can't seem to get the Focus events correct...code:
|
# ? Mar 1, 2007 02:03 |
|
Enter/Leave Edit: code:
JediGandalf fucked around with this message at 02:13 on Mar 1, 2007 |
# ? Mar 1, 2007 02:10 |
|
JediGandalf posted:Enter/Leave Still doesn't work - does it depend on my form setup or something? Edit: fixed - required me to add an event handler: code:
bartholomew_j fucked around with this message at 02:19 on Mar 1, 2007 |
# ? Mar 1, 2007 02:16 |
|
Well change mainBox to whatever name you desire. That's what I named my textbox control.
|
# ? Mar 1, 2007 02:26 |
|
Pulling my hair out over this one... I need to basically be able to do the following: code:
Any help would be awesome. I'm still figuring this beast out.
|
# ? Mar 1, 2007 04:04 |
|
Can someone recommend me a c# arbitrary sized integer library? Like if I wanted to keep track of a collection of ~10k digit number and add and subtract them?
|
# ? Mar 1, 2007 04:20 |
|
Victor helped me with my first question, but this one is still giving me trouble. I want the user to be able to drag a textfield around the form and when it's released to swap values with the textfield underneath it. In Java I used a MouseInputListener which had the methods for mousePressed, mouseDragged, and mouseReleased. I'm trying it with the MouseClick and MouseMoved but the text field keeps flickering between 0,0 and the mouse cursor. code:
|
# ? Mar 1, 2007 14:38 |
|
I don't have much experience with it, but shouldn't you be able to use the DragDrop event rather than manually doing this?
|
# ? Mar 1, 2007 15:38 |
|
Arms_Akimbo posted:Pulling my hair out over this one... Forget about the old VB6 poo poo. What are you trying to do here--get the data programmatically or bind to a control or what?
|
# ? Mar 1, 2007 15:59 |
|
rotor posted:Can someone recommend me a c# arbitrary sized integer library? Like if I wanted to keep track of a collection of ~10k digit number and add and subtract them? BigInt is supposed to be added to the framework sometime, though it may not be until the next VS release. I know both IronPython and F# include an arbitrary int package. You could always grab either of those and give it a shot (hooray for being able to use multiple languages).
|
# ? Mar 1, 2007 16:13 |
|
Hiro2k posted:Victor helped me with my first question, but this one is still giving me trouble. You could try setting e.Handled at the end of your event: code:
This MSDN page about the MouseMove event might be helpful if you haven't seen it already.
|
# ? Mar 1, 2007 16:16 |
|
No one's got any suggestions for my conundrum (top of this page)?
|
# ? Mar 1, 2007 18:32 |
|
havelock posted:BigInt is supposed to be added to the framework sometime, though it may not be until the next VS release. I know both IronPython and F# include an arbitrary int package. You could always grab either of those and give it a shot (hooray for being able to use multiple languages). This idea never occurred to me, as I've never used other languages in my c# apps. Can I use the BigInteger code from J#? And if so, how much lard will this add to the binary?
|
# ? Mar 1, 2007 19:04 |
|
rotor posted:This idea never occurred to me, as I've never used other languages in my c# apps. Can I use the BigInteger code from J#? And if so, how much lard will this add to the binary? The binary just has MSIL for any language, so there shouldn't be any extra lard for using a different language.
|
# ? Mar 1, 2007 19:13 |
|
rotor posted:This idea never occurred to me, as I've never used other languages in my c# apps. Can I use the BigInteger code from J#? And if so, how much lard will this add to the binary?
|
# ? Mar 1, 2007 19:15 |
|
I am trying to figure out how I can parse a file into my program and output its contents as the hex equivalent. I've done plenty of file parsing, but converting to hex is unknown to me. Could anyone offer me some classes to look at for my purposes?
|
# ? Mar 1, 2007 19:22 |
|
JediGandalf posted:No one's got any suggestions for my conundrum (top of this page)? A guy on google groups* says that canWrite returning true doesn't mean there's a valid connection for the write to go into and goes on to suggest that the machine may be attempting a larger number of connections than is supported by the OS (XP is apparently limited to 5). This makes sense to me because there would be a number of connections being made when the machine starts up. Have you tried looping then waiting while you get that exception? edit: * http://groups.google.com/group/microsoft.public.win32.programmer.networks/browse_thread/thread/7a387e592cd9ceb6/070e566f4d23f40d?lnk=st&q=system+service+%22System.IO.IOException%3A%22+System+unable+to+write+data+to+the+transport+connection%3A+an+existing+connection+was+forcibly+closed+by+the+remote+host&rnum=1&hl=en#070e566f4d23f40d I'm not too surprised that the forum software couldn't parse that
|
# ? Mar 1, 2007 19:44 |
|
poopiehead posted:The binary just has MSIL for any language, so there shouldn't be any extra lard for using a different language. I am so trying this tonight
|
# ? Mar 1, 2007 19:51 |
|
Lone_Strider posted:It should be cool, I used it for the java.util.zip library in an old project and it didn't bloat the binary at all. At least presuming the user had j# installed, which is not part of the default .NET deployment IIRC.
|
# ? Mar 1, 2007 20:34 |
|
wwb posted:Forget about the old VB6 poo poo. All I need is a value in a field in the first record. I need an index to relate multiple records I'll be saving to two seperate tables, and I just need to find out what the highest index currently is so I can increment it by one. Binding to controls is pretty cut and dry, it's getting access to individual records to extract data in code that's got me caught up.
|
# ? Mar 1, 2007 20:46 |
|
Well, that is mainly because SqlDataSource and the like are not really meant for direct data access but rather for binding to controls. You could do this a few ways: 1) Add a sql data source just to get the value. 1a) Just make a separate function to get the data using ExecScalar() 2) Capture one of the gridview events--like RowDataBound--and pick up the value there. 3) Use the field as a datakey and get the value there after the data is bound. For something more akin to ADO.OLD, you really have to forget about the DataSource controls and go back to good ole ADO.NET.
|
# ? Mar 1, 2007 22:30 |
|
I've got this asp.net problem and was wondering if anybody has any idea what is wrong: I'm developing this web site that uses a SiteMap file and roles based authorization to allow certain menu items to show up based on the users role (admins, customers, etc). I've configured it to use our SQL 2005 database to authenticate the users and IIS is configured to see the directory (its a sub directory to the root of our regular site, I'm using it just for testing purposes) as a virtual directory so it shows up. I've developed this on my local machine, and it works fine. But when deployed to our web server (Server 2003/IIS6), the roles aren't working. I can log in just fine, but I'm not getting any roles assigned. Here is some sample role checking I have: code:
|
# ? Mar 1, 2007 23:25 |
|
I just found my answer here
|
# ? Mar 2, 2007 00:03 |
|
wwb posted:Well, that is mainly because SqlDataSource and the like are not really meant for direct data access but rather for binding to controls. You could do this a few ways: I have a GridView on the page that has the information I need, the topmost index is always first in the list, it's unsortable on the client side. Can I pull a value from that? How would I go about doing that? I guess I could make an ugly hack and bind the data to an invisible label or something and pull it out of there.
|
# ? Mar 2, 2007 00:12 |
|
Munkeymon posted:A guy on google groups* says that canWrite returning true doesn't mean there's a valid connection for the write to go into and goes on to suggest that the machine may be attempting a larger number of connections than is supported by the OS (XP is apparently limited to 5). This makes sense to me because there would be a number of connections being made when the machine starts up. Have you tried looping then waiting while you get that exception?
|
# ? Mar 2, 2007 00:49 |
|
Arms_Akimbo posted:I have a GridView on the page that has the information I need, the topmost index is always first in the list, it's unsortable on the client side. Can I pull a value from that? How would I go about doing that? Screw it. I'm just going back to ADO. Nothing works the way it used to, heh. Thanks to the people who tried to help out.
|
# ? Mar 2, 2007 03:07 |
|
I'm trying to set the text of a listview sub item, but it doesn't appear to be playing ball I currently have the code foreach (sensibleField field in selectedList) { string msgstring = recordBuffer.Substring(field.Offset, field.Size); listView1.Items[j].SubItems[1].Text = "!!!!"; j++; } I can get the existing text out of the cell, but on any subitem other than the one at index 0 it refuses to set the text, what am I missing here?
|
# ? Mar 2, 2007 11:53 |
|
Make sure that there are some collumns in the listview. Make sure that the view is set to details. Here is some code to add an item that has a subitem. ListViewItem i = new ListViewItem(); i.Text = "List Item"; ListViewItem.ListViewSubItem si = new ListViewItem.ListViewSubItem(); si.Text = "List Sub Item"; i.SubItems.Add(si); listView1.Items.Add(i); Edit: here is some code to change the text of the subitem this.listView1.Items[0].SubItems[1].Text = "hey"; Grid Commander fucked around with this message at 00:00 on Mar 3, 2007 |
# ? Mar 2, 2007 23:56 |
|
There are already columns in the listview, and they all have text in them (which I set when the subitems were created). If i set the text of a subItem, then display its contents in a messagebox, the text in the messagebox is correct, but the subitem hasn't updated on screen. I've tried using the InvalidateRect and Update() methods on the listview, but I just cannot for the life of me get it to display the correct text in the field
|
# ? Mar 3, 2007 13:22 |
|
What is the best way to go about converting legacy c++ code to .Net? As I understand it, you can write C++\CLI wrapper classes, which you could then use in C# projects. How easy is this to do? Is there a better solution? Does anyone have any guides/books on doing this?
|
# ? Mar 3, 2007 15:34 |
|
Can visual studio sort the code within a class by return type or method name? That'd be handy.
|
# ? Mar 5, 2007 03:31 |
|
I have a parametrized SQL query that doesn't seem to work the commandText is "SELECT ID FROM tableAddress WHERE firstStreetLine = @firstStreetLine" I am building the parameter as ("@firstStreetLine", data) data is either a string or system.dbnull.value I'm not 100% sure it works for string values but I'm 100% sure it doesn't return anything with the null value. What value should I be using to get a returned value if the value of firstStreetLine is null? It inserts fine. (SQL Server 2005 express edition) Nurbs fucked around with this message at 06:17 on Mar 5, 2007 |
# ? Mar 5, 2007 06:09 |
|
deep square leg posted:Can visual studio sort the code within a class by return type or method name? That'd be handy. Not as a refactoring operation, but I always use the dropdown lists at the top of the codeview to do navaigation in large files. They sort alphabetically by member name.
|
# ? Mar 5, 2007 16:24 |
|
Nurbs posted:I have a parametrized SQL query that doesn't seem to work The problem is that you can't evaluate NULLs with the "=" operator. In order to know if a value is null, you have to use the syntax "IS NULL". Here's an example you can run in Query Analyzer. code:
code:
Incidentally, why not just build the command string directly so as to avoid futzing with the parameter? Joe Anglican fucked around with this message at 19:48 on Mar 5, 2007 |
# ? Mar 5, 2007 19:42 |
|
I'm playing around with rewriting a part of one of my company's products as a proof-of-concept, a windows service that connects hospital equipment together. As it stands now, we use named pipes to RPC from the UI to the service running in the background. What I'd like to experiment with is .NETizing it. I'd like to use ASP.NET as the UI and use remoting to call into the running .NET windows service. I've used .NET remoting as a method to communicate between 2 services on another project, but the company writing the other side pretty much said "do it this way and don't ask questions". Googling mutli-tier remoting turns up what I'd call some pretty shaky solutions as well. Can someone recommend some resources for advanced "Best Practices" n-Tier applications with .NET front-ends? To give you a little about my background and what I mean by advanced, I've been a full-time C++/Delphi/.NET developer for the past 12 years and have worked with mechanisms from shared memory regions to NamedPipes to DCOM to CORBA to SOAP to RPC-Via-FTP. I need something that will explain going beyond "Hello World" to something that scales well to hundreds of users without bringing the server to its knees.
|
# ? Mar 5, 2007 20:00 |
|
Joe Anglican posted:Incidentally, why not just build the command string directly so as to avoid futzing with the parameter? Anyway, couldn't you also do something like "SELECT ID FROM tableAddress WHERE firstStreetLine = @firstStreetLine OR (@firstStreetLine IS NULL AND firstStreetLine IS NULL)" or maybe have two separate queries, one which is the original and one which is just "SELECT ID FROM tableAddress WHERE firstStreetLine IS NULL" and then check in your code (assuming you are using this query in some external app) if the data is null, and if it is, run the second query instead.
|
# ? Mar 5, 2007 20:03 |
|
Jethro posted:Isn't the whole point of doing parameterized queries to avoid building the command string directly so as to avoid security holes? Let me back up, I thought there was a simple answer to this. I am migrating from one database schema to another. I have a function fnInsertAddress(s1,s2,city,state,zip,country) In order to prevent duplication I have a function call in this function fnGetAddressID(s1,s2,city,state,zip,country) The purpose of fnGetAddressID is to query the database for this address, and if it is already in the database, return the primary key of that record The problem I have found is that if any of the variables are NULL then they are not treated properly by the SELECT statement. So what you guys are saying is that I have to dynamically rewrite the commandText for each null variable? doable but a pain in the butt. Thanks for the help.
|
# ? Mar 5, 2007 21:26 |
|
|
# ? Jun 10, 2024 12:22 |
|
Hmm, could you re-normalize the table to have empty strings rather than nulls? Then you could just use the ISNULL function to replace things with empty strings in the query.
|
# ? Mar 5, 2007 22:32 |