Hi guys, I'm taking a class for which all my material must be written in C, not C++ or C#. Does anyone know if theres an expansion/download for visual studio that allows one to do this? I can get basic C to compile if i create a Visual C++ project > Win32 > Empty Project, and then rename a text file to the .c extension, but the DOS prompt won't wait on functions like scanf() that require user input. I really don't want to develop in vi on our campus Sun machines, so any input is much appreciated. Thanks, Justin
j1e1g1
Posts
-
Use 'C' in VS .NET 2003? -
Amazon.com API 4.0 HelpHi all, I am trying to develop a stand-alone windows application using C# .NET that uses the Amazon.com web services. I added the WSDL to my project as a web reference, but now I'm having a little trouble figuring out how to send a search request. in the API, there is an ItemSearch object, and ItemSearchRequest object, and an ItemSearchResponse object - could anyone show me how to use these to search by a keyword, passed to my function as a parameter? I know how to do it using AWS 3.0, but I cant figure it out in 4.0. Any help would be much appreciated. Thanks, Justin
-
Help: SQL UpdateSorry about the smileys, those are semicolons followed by the letter 'p'.
-
Help: SQL UpdateI'm using the .NET compact framework, and I'm trying unsuccessfully to do a SQL update. My code is as follows:
SqlConnection myConnection = new SqlConnection("User ID=abc;Password=123;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=factory;Data Source=servername");
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.UpdateCommand = new SqlCommand("UPDATE sn_allocatedblocks SET ab_status = 'Warehouse' WHERE ab_schedule = '"+schedule+"' AND ab_schedline = '"+schedline+"'", myConnection);
myConnection.Close();In the debugger, this code seems to work fine....it hits every line and goes through the function successfully. However, when I open up SQL Analyzer and check to see if it worked, nothing is changed. I'm positive that the user has permissions and that the query is correct, I just can't get it working in my program. I also tried using the ExecuteNonQuery method, but that always throws a SQLException:
SqlConnection myConnection = new SqlConnection("User ID=abc;Password=123;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=factory;Data Source=servername");
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.UpdateCommand = new SqlCommand("UPDATE sn_allocatedblocks SET ab_status = 'Production' WHERE ab_schedule = '"+schedule+"' AND ab_schedline = '"+schedline+"'", myConnection);
adapter.UpdateCommand.ExecuteNonQuery();
myConnection.Close(); -
String.Input and StreamWriterHi all, I'm working on a method that parses through a html source file, and puts coldfusion comments around script tags. My problem is that the String.Input method is not working with the line read from my streamreader. When using the debugger, it hits the .Input(index, string) line, but it does actually change my string. I think this is because the line is in a stream, but I'm not sure. I know there is a programmatically simple workaround for this, but I haven't done it in so long that I can't remember. Suggestions please - my code is as follows:
private void outputnoscript(StreamReader reader, StreamWriter writer)
{
string line = "";
int opencounter = 0;
int closecounter = 0;while(line!=null) { line = reader.ReadLine(); if (line!=null) { MatchCollection opencollection = Regex.Matches(line, "", RegexOptions.IgnoreCase); for (int i = 0; i < closecollection.Count; i++) { //insert a ---> at the position in the current match, +4 for every ---> already inserted Match closematch = closecollection\[i\]; //plus 8 is to accomodate for the fact that regex returns the position of "/" in "/script>" line.Insert(closematch.Index + 8 + closecounter, "--->"); closecounter += 4; } writer.WriteLine(line); } } }
-
Suggestions for Forum Replyer?Ok, well I figured out how to get IE started and go to the correct URL. I'm using System.Diagnostics.Process.Start("executable", "url"). Now I need to figure out how to "grab" the window, insert my text into the reply box, and hit the submit button... Suggestions/examples are appreciated. Thanks, Justin
-
Suggestions for Forum Replyer?Hey guys, I'm working on sort of a "proof of concept" program (using .NET and C#) that will generate random reply's to forum posts. My program takes a URL, which would be the URL of the page I am replying to, and submits a reply that is pulled from a word list. I'm trying to figure out the best way to open a connection to the page, and then put my mouse-pointer in the "message" box. I can't pass the message as a URL parameter or anything of the sort, because the forums are php/asp. So, does anyone have any ideas as to the best way to open a connection to the page, or on how to get "into" the reply box? To give you an idea, use my test board @ http://s6.invisionfree.com/Justin, and try replying to a post in the Concept forum - this is the process I want to automate. I just need some ideas on the best way to accomplish this...any suggestions are welcome. Thanks, Justin
-
Compact Framework TimerAnother problem I have encountered is using a timer in .NETCF. The start and stop methods are not available. I just want a timer to count 40 seconds, and at the end of 40 seconds, throw an error message. I feel like im crippled trying to use the CF....
-
Compact Framework Progress Bar?I'm trying to make a progress bar using the COmpact Framework for a Pocket PC. However, in the Compact Framework, there is no step property, nor is there a performstep method. Does anyone have an example of a working progress bar using the Compact Framework?. I just want it to float indepenently at the front of my application. Also, a messagebox of some sort with moving ... 's would be acceptable as well, but I don't know how to code it either.
-
Remove Confirm Dialog After Confirm?First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:
if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{
...execute tons of logic...
}Thanks, j1e1g1
-
Writing to Pocket PC File - Directory Structure?I am trying to write/read from a .dat file as part of a much larger C# application. The application was written using the .Net Compact Framework, and everything runs fine on my WinXp desktop. However, I am having trouble writing to file on the Pocket Pc, because I know very little about their directory structure. I would like the file I am writing to to be someplace where multiple users can access it, so not in My Documents. So my question is: what should i change this line System.IO.StreamReader file = new System.IO.StreamReader("c:\\mobile.dat"); to, in order not to get this exception A managed DirectoryNotFoundException occurred at Application::Run+0xf. I tried using "\\mobile.dat", but to no avail. Thanks, Justin
-
DoubleClick a TreeView Node?I have looked at the SDK, but it is all still a little overwhelming to a new .Net programmer. I guess I just need more practice with the syntax and necessary declarations of form control objects. Also, its still throwing an error, because I'm not passing treeView1_DoubleClick any parameters in this line: this.treeView1.DoubleClick += new EventHandler(treeView1_DoubleClick); I'm not sure what sender object or event args I should pass here, since I'm really just initializing the DoubleClick event... Error:'WindowsApplication5.Form1.treeView1_DoubleClick(object, System.Windows.Forms.TreeViewEventArgs)' does not match delegate 'void System.EventHandler(object, System.EventArgs)' Thanks for your help and patience, Justin
-
DoubleClick a TreeView Node?This line: this.treeView1.DoubleClick += new System.EventHandler(this.treeView1_DoubleClick); Still throws an error, because I'm not passing this.treeView1_DoubleClick any parameters. I'm not sure what I should pass here, other than (?nulls), because I don't have a sender object or an event arg to pass it. Here is the error: Method 'WindowsApplication5.Form1.treeView1_DoubleClick(object, System.Windows.Forms.TreeViewEventArgs)' does not match delegate 'void System.EventHandler(object, System.EventArgs)' Sorry if this seems elementary, I'm still learning.. Thank you for your patience and your helpful responses, Justin
-
DoubleClick a TreeView Node?I tried replacing "AfterSelect" with DoubleClick, but when I compile I get this error:"D:\Documents\Visual Studio Projects\WindowsApplication5\Form1.cs(70): Cannot implicitly convert type 'System.Windows.Forms.TreeViewEventHandler' to 'System.EventHandler' " from this line: "this.treeView1.DoubleClick += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_DoubleClick);". I tried casting this.treeView1.DoubleCLick to a TreeViewEventHandler, but it won't let me do that either. Any suggestions? (sorry, I'm very new to C#) Also, would it be possible to change the event from DoubleClick to when the user presses the "Enter" key? If so, what is the event for this? Thanks, Justin
-
DoubleClick a TreeView Node?Update: I tried replacing "AfterSelect" with DoubleClick, but when I compile I get this error:"D:\Documents\Visual Studio Projects\WindowsApplication5\Form1.cs(70): Cannot implicitly convert type 'System.Windows.Forms.TreeViewEventHandler' to 'System.EventHandler' " from this line: "this.treeView1.DoubleClick += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_DoubleClick);". I tried casting this.treeView1.DoubleCLick to a TreeViewEventHandler, but it won't let me do that either. Any suggestions? (sorry, I'm very new to C#) Also, would it be possible to change the event from DoubleClick to when the user presses the "Enter" key? If so, what is the event for this? Thanks, Justin Original Question: I am relativley new to C#, and I'm trying to write an app, using the compact framework, that will allow a handheld user to scroll through a treeview, hit enter on a selected node, and then do something specific to that node. I figured that the doubleclick event was as close as I could get to actually pressing enter/return, but I still cannot figure out how to write a method that is specific to a node of the treeview, rather than the entire treeview. When I doubleclick on the treeview in design mode, regardless of what node I click on, the only code it creates for me is private void treeView1_AfterSelect(...). So, does anyone know how to setup a function that will do something when the user doubleclicks/hits enter on a node of a treeview? Examples are much appreciated. Thanks, j1e1g1