|
hi sathyan,
use following code at click event of edit menu
form2.nametextbox= Grid1.CurrentRow.Cells(0).Value.ToString
form2.agetextbox= Grid1.CurrentRow.Cells(1).Value.ToString
form2.rollnotextbox= Grid1.CurrentRow.Cells(2).Value.ToString
form2.addresstextbox= Grid1.CurrentRow.Cells(3).Value.ToString
form2.show
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
[img]http://i53.photobucket.com/albums/g56/marshmayllow/slidepuzzle.jpg[/img]
This' how the puzzle works. Quite sure everyone knows this game!
I'm a complete noob at this, and have not a slightest clue on how to start building the codes except that:
1. the buttons don't move (am i suppose to put the numbers under the 'text' property of the button?)
2. reseting it will give a new random arrangment
would be interested to know how to replace the numbers with images too..really thanks a million to whoever can help a poor soul here !
|
|
|
|
|
One has to ask why you're writing this, if you have no idea how to do it ? If it's homework, you should ask your teacher. If you're just trying to learn, I'd recommend trying something simpler first.
marshmayllow wrote: would be interested to know how to replace the numbers with images too
Buttons have an Image property.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i want to create a gridview like editable custom control which may have combobox in one or more then one column .
at the time of specifing datasource to custom control it should fill data in Comboxes also.
mahendra
|
|
|
|
|
Hi,
I am using a ToolStrip that doesn't use the (default) DockStyle.Top setting because I set its AnchorStyles (to Top, Left and Right), by which the Dock property is overruled. The reason for this is that multiple Toolstrips need to be shown below each other.
The problem is that the Overflow button on the Toolstrip doesn't appear anymore when needed. When I dont set the AnchorStyles property, the Overflow button appears, but then the ToolStrips ignore the Location I give them and appear in the wrong order because they all have DockStyle.Top again.
Thanks.
Jim
|
|
|
|
|
Gday,
Ok first question....go easy
Im trying to make the text in a label change according to what is chosen in a combo box. I dont get why this doesnt change the text in the lblRate. Would appreciate any advice?
Private Sub cmbPlanes_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPlanes.SelectedIndexChanged<br />
<br />
Select Case Aircraft<br />
Case "Cessna 152"<br />
lblRate.Text = "$119"<br />
Case "Cessna 172"<br />
lblRate.Text = "$135"<br />
Case "Piper Cherokee"<br />
lblRate.Text = "$135"<br />
Case "Gazelle"<br />
lblRate.Text = "$85"<br />
Case "Gazelle"<br />
lblRate.Text = "$135"<br />
Case "Tecnam"<br />
lblRate.Text = "$110"<br />
Case "Beech Bonanza"<br />
lblRate.Text = "$289"<br />
Case Else<br />
lblRate.Text = "$0.00"<br />
End Select<br />
<br />
<br />
<br />
<br />
End Sub<br />
-- modified at 18:37 Saturday 2nd June, 2007
|
|
|
|
|
First guess - Aircraft is a variable that is not being changed. I suspect you want to set it from the cmbPlanes combo box.
Setting a breakpoint and stepping through would confirm if this is the case.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ok....Im showing my ignorance here but I dont get that.
what do you mean set it from the cmbPlanes combo box? If i use the drop down to choose an aircraft I want the lblRate text to change. (which Im sure you already knew) So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text? How do I link the variable named Aircraft to the chosen index in the combobox?
second....setting a breakpoint is beyond me at this stage..I have no idea how to do that.
Ouch!
|
|
|
|
|
idyot wrote: So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text?
In your case, yes.
Select Case cmbPlanes.Text
idyot wrote: How do I link the variable named Aircraft to the chosen index in the combobox
OK. To recant what I just said...If Airplane is a string varible, then all you do is something like this in your posted code:
Airplane = cmbPlanes.Text
Select Case Airplane
Case ....
This is really VB.NET 101 type stuff. I suggest picking up a book on VB.NET for beginners.
How you're doing this now isn't really the correct way of doing it in the first place. Normally, you'd have this data (and more) in a DataTable, or some other collection, and bind your controls to this data. Picking an item in the ComboBox would automatically select the rest of the records data.
I'm not really going to go into how this works because it's a more advanced technique. Something that will boggle your mind if you don't understand how Select/Case works yet.
Seriously, pick up a book or two.
|
|
|
|
|
Dave Kreskowiak wrote: This is really VB.NET 101 type stuff. I suggest picking up a book on VB.NET for beginners.
Yes its been discussed at length here over the past day or two...Dont know if you agree or not but I think there is no real place or decent books for absolute beginners to learn the code..plenty for form design but not for code, unless your at college I guess ya stuffed.
thanks for your help , Ill move on
Cheers
|
|
|
|
|
Dave Kreskowiak wrote: How you're doing this now isn't really the correct way of doing it in the first place. Normally, you'd have this data (and more) in a DataTable, or some other collection, and bind your controls to this data. Picking an item in the ComboBox would automatically select the rest of the records data.
I'm not really going to go into how this works because it's a more advanced technique. Something that will boggle your mind if you don't understand how Select/Case works yet.
Yes I know its not the best, I am just trying to start! I was thinking of using the case satement so later on I could work out how to include a form so that aircraft and rates could be added at will.
I have the labels etc working using if statements but was trying to look ahead. Perhaps too far
Your right its 101 but the only advice I can get re learning to code is to find a patient and experienced friend to assist or to just ask questions here. As you may be able to tell from my manner..I have no friends ..so it leaves me one option!
|
|
|
|
|
I taught myself out of the reference manuals for various languages. I used the books off the shelf for a basis to apply what I saw in the references. So how did I learn the language? Hit F1...
|
|
|
|
|
|
idyot wrote: So are u saying that I dont need to declare this as a variable and instead just use cmbPlanes.Text?
Yeah, I think Dave has this all covered, but...
The combo box contains the selected text. If all you want to do is know what the selected text is, there's no point moving it to another variable, but if yuo have a need to do that, you need to set the value of that variable, it won't set itself.
idyot wrote: second....setting a breakpoint is beyond me at this stage..I have no idea how to do that.
OK, this is a major thing to know, this will help you a lot. If you put your cursor on a line of code and hit F9, a little dot will appear in the code. Assuming you're running in debug mode ( which is the default ), when you press F5 and the program runs, it will stop at this line of code. You will be able to see the watch window in the bottom area, in this you can type things like cmbPlanes, and you'll see the value of the variable, and if it has properties, you can browse them. You can even call methods in this box, and they will execute immediately, or type things like Airplanes = "Messerschmidt" and the value will change. This is an invaluable tool for working out what's going on inside your code, especially when you don't know why it's not working. You can just hover the mouse over a variable while the code is at a breakpoint and see it's value, so this would have told you, in this case, that Airplane was not being set to the selected text. You can also use the function keys or menu items in the debug menu to step through code, or set which code runs next, so you can really trace exactly what your code is doing, and how this affects the state of your application.
Hope that helps.
If you're remotely willing to consider C#, I can recommend some good books. Actually, even if you bought a book like 'Inside C#' and used it to learn some overall concepts, C# and VB.NET are basically the same, just different formatting.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Gday again.
Yeah Ive been working through it all using F1.....niot easy when you dont really know what ya searching for but here is where Im at!
I got it working using the case select after what you said earlier. It made sense after I thought about it for a while, so Im pretty happy with that now.
Where Im stuck now (hesitating to ask cos its 101 stuff again) is converting a string to a value so it can be used for calculations. Looked in books , looked in F1 and have this working but I doubt its the right way
lblRate.Text = Format(lblRate.Text, "currency") and
lblTotalAircraftCost.Text = AircraftRate * (Val(txtAircraftHours.Text))
Now Im sure your all wetting ya'selves laughing right now, but Im 100 miles ahead of where I was 8 hours ago so Im happy...and happy to give ya'all a laugh at my expense!
Cheers
Mate Id be happy to consider anything if u know of any decent books, I dont wanna clog the forum up with uneducated stupid questions...you know I reckon this is like golf...frustrating as hell but when ya get that one thing that goes right it keeps ya coming back for more!
|
|
|
|
|
idyot wrote: Now Im sure your all wetting ya'selves laughing right now
Not at all - I remember being new to all this stuff, I'm not THAT old or cynical :P
There are many ways to turn a string into a number. By far the best is to do this:
Dim hours as int
if (int.TryParse(txtAircraftHours.Text, hours)) then
lblTotalAircraftCost.Text = AircraftRate * hours
end if
Now, here's a funny thing. I don't use VB.NET. I help here because most questions I can answer as they relate to the framwork. So, I *think* this works because VB will turn a number into a string by magic ( I think your code was doing this also ). int.TryParse *definately* takes a string and an int, and if it can convert the string to an int, it sets the int value and returns true. This means it checks for you and won't blow up ( as other methods will ), if the string is not convertible.
idyot wrote: frustrating as hell but when ya get that one thing that goes right it keeps ya coming back for more!
Yeah, I can still remember how excited I was when I got my first little c++ projects to do something.
The book Inside C# by Tom Archer is a pretty decent overview of the C# language. If you get it, be sure to get the second edition, even that is out of date. But, it's a good, language focused book.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hey I got that working ok...thanks heaps!
Last thing for now ..if you could at least point me in the right direction and Ill try to work the rest out
The combo box holds a collection of items, right now they are checked directly in Select Case, what I would like to do now, is , as suggested (I think) before by Dave is to set it up so that the using the dropdown menu to select the aircraft, automatically populates the labels etc with data from a table somewhere.
The idea being the a new aircraft can be added, prices change, aircraft removed etc..all from another form, without having to go into the code to change aircraft names/rates etc. And I am aware that its prolly way above my current skill level but I wouldnt mind having a crack
Now I dont expect you to tell exactly how to do it but I would appreciate someone telling me what it is Im searching for in the MSDN or other. Often Im finding the problem is not knowing the right stuff to search for..
|
|
|
|
|
The core question is, how will you store the information ? I'd lean towards an XML file, which means you need to go to the w3c site to read their tutorials on XPath, so you know how to search your XML to get the values out. A database is probably easier to search, but more work to set up. SQL Server Express is free, if you wanted to try that instead.
If you set up XML like
<airplanes>
<plane>
<name>Messerschmidt
<year>1942
<origin>German
<passengers>2
( or whatever data you want, obviously )
then you can load it into an XmlDocument with the Load method, and do a foreach on document.SelectNodes("/airplanes/plane") which will give you a node for each group, then you can do node.SelectSingleNode("name") for the node with the name, etc.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have finally found a good VB.NET book, purchased it today and am already through the first 4 chapters....Deitels How to program in Visual Basic.NET. Its the first one Ive found that actually DOES talk about HOW to program in VB.NET and doesnt spend 75% of the book on form design!
Ordered the Inside C# book you mentioned, by the time it arrives I should have more of an idea of whats going on!
Cheers
|
|
|
|
|
idyot wrote: Where Im stuck now (hesitating to ask cos its 101 stuff again) is converting a string to a value so it can be used for calculations. Looked in books , looked in F1 and have this working but I doubt its the right way
Well, we're not laughing at you. We all had to learn the languages somehow. The trick to learning the language isn't trying to write an application while you don't know the language. You're trying to put together a puzzle without knowing what the pieces look like.
Turn this around and learn what the puzzle pieces look like first. How I did it was to look at some functions in the references and write tiny apps to see how they worked. Stepping through them with the debugger and examining the values. Changing tiny pieces here and there to see what effect they had. Learn what the basic data types are and what the functions and method are looking for in their parameters and what types they return.
I can pickup and learn any language I want in a very short time because I completely understand all the basic types and how OOP works.
|
|
|
|
|
idyot wrote: I dont wanna clog the forum up with uneducated stupid questions...
I don't think you are clogging up the forums with your questions. You are learning and this isn't a bad place to ask for help.
idyot wrote: know of any decent books
Not sure if one exists. You may want to look at Apress VB.Net books[^]. I've picked a few of their books in the past, primarily SQL 2005 books, and they seem pretty alright
A few decent books, codeproject, and google, you'll be set
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
This may be a dumb question but are you doing this as a WinForms project or is it a web app? If a web app, check that you've set the drop down list to trigger an AutoPostBack (I think it's called that or something similar on the properties sheet).
Just the fact that you've called it a combo box and not a drop down list leans me to believe this is a WinForms thing but I'm just trying to eliminate the impossible.
|
|
|
|
|
Hi friends
Please help me out with my problem. I am uploading an html file after every 10 seconds to my website with the help of VB.net 2002 and framework 1.0. I have used exception handling in each and every part where ever it was needed. Now when I execute, the application stops responding after say 10 minutes (not fixed sometimes it functions properly for an hour or more), without giving any exception. I am stuck with the problem - don't know the problem occurs because of the Internet speed or there is some problem with my VB.net code. Hoping for an early positive response. Thanks
Nakul
|
|
|
|
|
There's very little we can tell you about what may be wrong because we don't know the circumstances under which the code is running, nor do we know anything about your code. How big is/are the file(s)? How long do they take to transfer (average)? Is this is local web server you're uploading to, or remote? ...
Personaly, I think FTP'ing a file every 10 seconds is a bit much to ask. ANY lag in that process stands the risk of having the code rerun and try to upload another file while the previous one is still being transferred. Of course, that depends on how you're code is written.
Does your code properly logout of the FTP server when it's done uploading the file(s)? If not, how long does the FTP server wait before it times out the session and destroys it?
|
|
|
|
|
Respected Sir
Thanks for you concern. The file size is around 3 KB only. It just takes less than a second for the transfer to the reomote server. Upload speed at my place is around 8-10 KBytes/sec
What I am doing is in each cycle, I first logs on to the remote server (logs on to my website), then I transfer the file and after that I dosconnects.
It always logs onto the server successfully, but sometimes it fails during the tansfer, so what I think is it always stuck up during the file transfer phase.
(phase1: Logging onto the server, phase2: File Transfer, phase3: Disconnects)
Please can you help a bit more regarding this, I shall be greatfull to you.
Regards
Nakul
|
|
|
|
|