|
ypki wrote: How can i save the values which is addes to a listview control.
What do you mean by 'save'? To a file? A database?
You should provide enough information in your question for someone to be able to assist you with a solution.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
sorry..i mean to save in database
Thanks
|
|
|
|
|
sorry...i mean to save in database
for eg.
i have some textbox controls, after entering some values in it and hit enter,the values move to listview,more than one rows may enter into listview.There is another button, hiting on that the values in the listview need to save in the database.
Thanks
Yesu
|
|
|
|
|
You need to provide more information as to how you want to save. You can save to a file or a database.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
sorry..i mean to save in database
for eg.
i have some textbox controls, after entering some values in it and hit enter,the values move to listview,more than one rows may enter into listview.There is another button, hiting on that the values in the listview need to save in the database.
Thanks
Yesu
|
|
|
|
|
You just do an insert query into your database, however it is set up. Then, when you run the app again, you query for those items in your listbox and populate it from the query results.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
but i am not getting the value to insert.
i use
Dim lstSel As ListViewItem
lstSel.SubItems(2).ToString and val(lstSel.SubItems(2).ToString)
to take value from the cells of the listview.
only string value is getting for insert.
thks
yesu
|
|
|
|
|
Sorry, I haven't got back to you in a while. Is this working now or are you still having trouble?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I am trying to do a game of pong. My problem is, i can't get the ball served to a patricular point or location. By changing a valriables value i can get the ball served either to the left or right, up or down. the ball is located in thr middle of the form. When i serve the ball it will either do up or down and then bounce off the top or bottom, so if i want to serve a ball directly to a point say in the top left hand corner. i can't.
here are the variables i am using and a bit of code trying to explain what i mean
i'm using a timer for the ball speed
Dim XChange As Integer = -5
Dim YChange As Integer = 5
Dim BallDirX As Integer 'for direction
Dim BallDirY As Integer 'for direction
Dim X, Y As Integer 'unused just in case
If picBall.Top < 0 Then
picBall.Top = 0
XChange = -5
YChange = 5
Here I want the ball to bounce off the wall and goto a YPoint say 50 and the xpoint as zero as the ball bounces in thay direction
End If
thnks from Zeldacat
Regards
Zeldacat
|
|
|
|
|
I'm assuming from the code you have given that the ball can only move by a cirtain amount each time (5pix up/down and 5pix left/right)... this might not be enough.
What you need to do is calculate both the horizontal and vertical distances to the wall and then divide them by the number of ticks you want the ball to move until it reaches the wall: this is the amount you need to move the ball each timer tick...
If the distance to the left wall is 100 pixels (for example) and the distance you want the ball to travel downwards is 40 pixels (giving the target position of (0, 40)) then the ball will need to move 100/N to the left and 40/N downwards each timer tick, where N is the number of ticks you want the ball to move until it reaches the wall.
I believe this would work: it requires the ball's vertical/horizontal speed to be something other than 5 pixels per tick though.
Essentially you need to use relative positioning rather than absolute positioning.
(Small edit at 3:45).
Hope this helps.
Matthew Butler
modified on Saturday, December 15, 2007 10:42:33 AM
|
|
|
|
|
I am playing a ppt file in a webbrowser on form1. When I navigate from form1 to form2, form1 keeps running in the background.
The problem - If the ppt has got an associated sound with it, the sound remains playing even after navigating to form2. Is there anyway to just stop the sound of the ppt while navigating? Webbrowser control does not have any suitable property using which I can only put off the sound. I am not disposing form1 after use because loading a ppt on every request takes substantial amount of time.
Any help would be appreciated.
|
|
|
|
|
I am playing a ppt file in a webbrowser on form1. When I navigate from form1 to form2, form1 keeps running in the background.
The problem - If the ppt has got an associated sound with it, the sound remains playing even after navigating to form2. Is there anyway to just stop the sound of the ppt while navigating? Webbrowser control does not have any suitable property using which I can only put off the sound. I am not disposing form1 after use because loading a ppt on every request takes substantial amount of time.
Any help would be appreciated.
|
|
|
|
|
sushma belur wrote: When I navigate from form1 to form2, form1 keeps running in the background.
Yeah, as it should. Are you saying that your webbrowser in on Form1, and when you do something on Form2, the webbrowser on Form1 should stop playing sound?? It won't do that unless you either tell the webbrowser to navigate to another page or if you destroy the instance of Form1 that is currently running. Your code doesn't have access to the PowerPoint plugin inside the webbrowser control to stop the sound from playing.
|
|
|
|
|
My goal is to offer a way for the user to choose a database from the open file dialog and then display all the tables in the database for him to choose one. then my code will take that table he choose and be put into a variable. How do you get the table names using sql statement. And how can I display into a combobx. I could not find anything on google or Code Project that has all I want. I need vb.net code to get table names for Access and Sql server databases. Any help would be appreciated. thank you.
|
|
|
|
|
How do you hope to connect to a SQL Server database via an open file dialog ? I found heaps of google hits for finding the tables and databases in a SQL Server instance.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Cory Kimble wrote: I could not find anything on google or Code Project that has all I want.
I also did a quick search on Google and quickly found the following articles:
Get table names for MS Access database[^]
Get table names for SQL Server database[^]
They should get you started.
Cory Kimble wrote: I need vb.net code to get table names for Access and Sql server databases.
Generally speaking, it isn't considered polite to ask for code without having made a serious attempt to solve the problem yourself. I suggest that you look at the above article, try and solve the problem yourself and post again in you encounter any further difficulties.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
The article you suggested is for C# I need for VB.net
|
|
|
|
|
Cory Kimble wrote: The article you suggested is for C# I need for VB.net
So convert it. There are plenty of tools available online to do this. Alternatively, learn C#.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
How do I add args to System.Timers.ElapsedEventArgs? For example, I have a process running and after an elapsed time I want to pass its process.id to my TimerElapsed handler. I'm a bit of a newbie, but don't be gentle with me
Many thanks to any who take the time to answer...
R
|
|
|
|
|
You can't change an existing class, you can derive a class from this one, but you can't make the event use it. You need to find another way of passing this value, probably using your own delegate.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian. This has turned out to be surprisingly complicated. Surely others are passing something into their timer event handlers other than the fact that "time's up", I've got a perfectly good bar-tender for that.
At present my lack of ability has me stuck between two cludges;
1. System.Threading.Thread.Sleep and let the rest of my WinService wait (which it can't, life's too short), or
2. Instantiate a timer before I even know whether there's an issue with any of the processes I'm interested in, then look for the pids at the other end. Yuk!
This has to have been done before?
R
|
|
|
|
|
Hi,
what you can do with a timer, you probably can also do with an extra thread and indeed
a Thread.Sleep; that way the existing threads continue as before, and the new thread can,
posibly executing within its own class, hold and keep whatever information and state you
want it to have.
there may be and probably are more elegant approaches to what you need, but then I would like
to better understand what it is you want to achieve.
|
|
|
|
|
And now I see threading lets me pass in the pid as an object...
Dim myParamThread As New Thread(AddressOf myParamHandlerThread)<br />
myParamThread.Start(CType(p.id, Object))<br />
<br />
Private Sub paramHandlerThread(ByVal obj As Object)<br />
Dim Proc As Process = Process.GetProcessById(CType(obj, Integer))<br />
Sleep(interval)' then do stuff<br />
End Sub<br />
<br />
Thanks.
|
|
|
|
|
I'm sure it can be done, but not in the way you're suggesting. You cannot add to an existing event args class, and you cannot change which class the framework uses to fire an event.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian and Luc,
First real coding I've done since VB6, hadn't realised creating a new thread was quite so easy, though I still can't pass in an argument. Will cludge sth as follows while I continue getting my head round delegates and such.
Dim myProc1Thread as new Thread(AddressOf Proc1Handler)<br />
myProc1Thread.IsBackground=True<br />
myProc1Thread.Start()<br />
<br />
Private Sub Proc1Handler()<br />
Dim Processes As Process() = Process.GetProcessesByName("processName")<br />
If Processes.Length > 0<br />
System.Threading.Thread.Sleep(interval)<br />
For Each p As Process In Processes<br />
If Not p.HasExited Then<br />
'Do something<br />
...<br />
Thanks again,
R
|
|
|
|