|
Sounds like a homework assignment, so here are only some hints:
Create a textbox for the price and a textbox for the # of hours (a NumericUpDown control may be better for the latter, no string-to-number conversion required there).
Create a button clicked event handler for the calculate button and do the calculation there.
You can convert from the textbox string to decimal/integer via Decimal.TryParse[^] or Int32.TryParse[^] method, respectively.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote: Sounds like a homework assignment
His post down further in the thread really make me suspicious, it sounds like a problem I use in my class, and the funny thing is, my class doesn't start for a few more weeks.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
fratboy trying to repair damage to the cheat library before school restarts because a helpful student cleaner tossed them all over the summer?
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Yep. Like I just told Guffa, my very similar problem is usually assigned about mid-October for the Fall term. People may look to the assistance of my former students are going to be in for a rude surprise. After about 2 years of teaching this class, I am doing a complete overhaul of it
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
So... the schools have started again...
The calculation part of the code is very easy:
price = pricePerHour * hours;
So, is that really where your problem lies?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: So, is that really where your problem lies?
Nah, I don't think they teach programming in 4th grade.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Guffa wrote: the schools have started again...
Maybe. My class doesn't start for a few more weeks, and the OP's problem sounds very similar to one of my homework problems I give out, and this particular won't be assigned until the middle of October. Sorry, no credit given to the OP for two reasons: 1. I don't accept early work, 2. Wrong language, not a C# class
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
P. S.
//Calculate the total cost of charter by number of hours X selected yacht x the rate per hour.
The above is the calculation I was thing of using.
I'm having trouble coding it.
Jeff
|
|
|
|
|
I think Guffa very kindly answered (solved) your coding dilemma. But but here it is stated another way...
HAI
CAN HAS STDIO?
I HAS A rate ITZ NUMBAR
I HAS A hours ITZ NUMBAR
LOL ducketsOwed R rate TIEMZ hours
VISIBLE ducketsOwed
KTHXBYE
Seriously though, are you having trouble setting up the project or what? I don't get it, your questions is solved, but you restated the question... what more do you need?
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
*********** U need to Learn Do your homework by yoursellf **********
double total = Convert.ToDouble(TextBox_item_rented.Text) * Convert.ToDouble(TextBox_cost_per_hour.Text);
TextBox_total=total.ToString();
MessageBox.Show("Total Cost for customer "+ TextBox_cust_name.Text + "= " + total);
*********** U need to Learn Do your homework by yoursellf **********
|
|
|
|
|
I am working on a Windows Application where I have a button that creates tabs in my Tab Control at run-time. The controls inside of those tabs are obtained from a User Control which I created. I would like to now add functionality to allow a user to close each particular tab with a button inside each tab that gets created at run-time. I am having a hard time figuring out how to access the tab control (located in the main form area) from within the User Control to accomplish this purpose. If anyone has any ideas or suggestions, it would be greatly appreciated!!!
|
|
|
|
|
There's no built-in functionality for a close button in the default tab control. Maybe you can use this control[^] instead?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
When you create the Tab and the user control, put a reference to it in the user control's close button, perhaps in the Tag property.
That will then let the Button know which Tab to close.
Something kinda like:
tab = new Tab() ;
usr = new usercontrol() ;
usr.bClose.Tag = tab ;
tab.Controls.Add ( usr ) ;
pag.TabPages.Add ( tab ) ;
And the button click handler can do something like:
if ( Tag is TabPage )
{
pag.TabPages.Remove ( (TabPage) Tag ) ;
}
Or maybe use the Button's Parent property to get the UserControl, use the UserControl's Parent Property to get the TabPage, use the TabPage's Parent property to get the TabControl, then Remove the TabPage from the TabControl.
modified on Friday, August 15, 2008 11:23 AM
|
|
|
|
|
I have a project running which requires me to use a specific .dll file. It is no .COM related .dll file, so I cannot add it to my references list in VS2008.
The .dll file is used by another program to encode and decode packets that will be send over the network. All I know is, is that this .dll file is used for that. If I do a dumpbin, I can see some methodnames that are preceded and followed by non-regular characters. To atleast load the method in my code, I use the ordinal instead with the DllImport.EndPoint parameter.
Now comes in my real problem. I do not know the return value nor the parameters that this method requires. All I get when I try to run invoke it, I get an error indicating VS2008 could not marshal the values I have given.
So, is it possible for me to find out what the return value is of that method and what types of parameters it requires? It is not possible for me to get any hands on documentation, so basically all I have is this .dll file. Note that it is currently used by another program, maybe I can do something with that?
Thank you in advance and I hope it is possible in some way to figure out the return and parameter types for a .dll method.
|
|
|
|
|
Since it's no COM or .NET dll, you can't find out which parameters are used apart from consulting the documentation. You can guess though, but chances that you find out the correct parameter types are extremely small.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I guess dumpbin.exe is used for this purpose. I dont remember the exact command though. Google will help you to get that.
|
|
|
|
|
I used the dumpbin for extracting all the information I can get from it with the -all and -out:destination commands.
From there I got the oridinal codes for the methods (because the method names are messed up a bit).
I do not get any other information from dumpbin, unless it is masekd in there somewhere. If you know how to read the output and convert it somehow in some parameters, that would be awesome.
I have a program that already uses this .dll-file, is it possible to somehow hook between this link so I can see what exactly is sent to the .dll-file? Maybe I can then figure out the parameters by searching for values in the lparam and wparam parameters.
Thank you for your time, if you know something more, please let me know.
|
|
|
|
|
I've found a way to keep custom types working smoothly through web services, and I'd like to know what others think. Maybe this is already obvious common practise... if so, please let me know -- it'd be reassuring. Also: please criticize
1. An assembly "Domain" containing:
class DomainObject { }
interface IDomainProvider
{
void Post(DomainObject do);
DomainObject[] Query(string query);
}
abstract class DomainProvider : ProviderBase, IDomainProvider { ... }
class StubDomainProvider { ... }
2. An assembly "Domain.WebServices" with app.config specifying StubDomainProvider as the default provider:
class DomainWebService : WebService, IDomainProvider { ... }
3. Back in the "Domain" assembly, a web reference to DomainWebService. Since DomainObject uses xml serialization attributes, its schema is nicely preserved: the web reference automatically generates its own DomainWebService.DomainObject class.
4. In the original DomainObject class,
public static explicit operator DomainWebService.DomainObject (DomainObject obj)
{
}
public static explicit operator DomainWebService.DomainObject(DomainObject obj)
{
}
5. Finally, still in the "Domain" assembly,
public WSDomainProvider : DomainProvider { ... }
Pros:
* WSDomainProvider is easy to implement.
Cons:
* DomainObject has to use xml serialization attributes, not IXmlSerializable.
Does any part of this get your spidey-sense tingling? Does it seem like a bad idea in any way? Maybe it makes schema updates more painful than necessary, or maybe putting web references in the Domain assembly is bad practise...
|
|
|
|
|
Hi,
This seems working. Question: Do you want to share the same class on both sides of the web service or do you want to have separate classes which are identical on both sides of web services. This could also be rephrased like, if you modify domain object, do you want the new situation to automatically affect both sides, which would make sense if you define the class in a common assembly which is referenced both in client and server?
Mika
|
|
|
|
|
Thanks! That's the sort of response I'm looking for.
I want to deploy the same assembly to both clients and servers, but I want to be able to update the server assemblies without requiring updates on the clients. I'm pretty sure this is only possible when the update has no effect on the schema. Is this what your question is about?
It'd be nice if I could do things this way and still have server updates that don't break the clients. Keeping this design, the only way I know of is to add a property bag to DomainObject, so any future properties can just be serialized as, say, a list of KeyValuePairs. It makes the XML a bit less clean and the schema validation a less useful...
|
|
|
|
|
Yes, that's what I was asking. By using interfaces you can quarantee that client "sees" the correct data even if you add new properties to classes (as long as you implement the "old" interface).
However, if you don't do any modifications on client side and at the same time you add new data at server side, can the client interpret the new data (so it's fully dynamic at client side)? If so, would it be reasonable to use datataset as web service parameters? This way you wouldn't have to create custom logic to transfer dynamic data.
Mika
|
|
|
|
|
Bluetooth programming for .NET Framework v2.0 in VS2005
I downloaded the Franson Bluetool SDK ( http://franson.com/bluetools/download.asp?platform=net ) and tried the example C:\Program\Franson\BlueTools SDK v1.21\dotNet200\C#\FindAndConnect. No devices are listed after I hit the 'Discover' button and wait a while. Sometimes I get an error message claiming that Bluetooth is disabled. The Bluetooth LED is clearly lit on my laptop and using the systray tool I can connect to other Bluetooth devices. But my applications can't find even one device. I also have a C++ application ( this one http://www.codeproject.com/KB/winsdk/BluetoothAPI__Device_Enum.aspx ) which builds but also can't find even one device when scanning.
Does my systray Bluetooth tool steal the access to the entire Microsoft Bluetooth stack so I have to kill it for my applications to find any devices? (Seems wierd) Shouldn't you be able to establish a Bluetooth connection eventhough it's running?
|
|
|
|
|
Hi,
Who here has used or knows about code that exports a datatable to excel, that handles quotes ". Try any.
I'll appreciate your help.
Let's do this !
|
|
|
|
|
Nice try maite
Original Post Link[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|