|
Yes, you can do that. However you will run into the problem of getting information across threads. To get around this, i'd recommend encapsulating both movements into their own class and run them on seperate threads. Within the class you would create delegates that would fire each time the key is pressed and each time the timer ticks. The delegate would then fire an event on your main form to update the appropriate picturebox.
I don't have VB available on this computer to write a quick example, but you can easily do a google on delegates to find out how to work those.
I know this doesn't give you the answer, but it gives you a path to start on If you still have troubles, let me know. I can write something up when I get home tonight.
|
|
|
|
|
hi
i'm trying to buld a project that asks the user to enter a number of nodes and then according to that number i need to build a a map with that number of nodes.
Any help would be appreciated
thank you in advance
|
|
|
|
|
Hi all,
I'm using Visual Basic 2005. I would like to loop through the controls
and wite or get some properties based on the controls.
This is the following piece of code in Visual Basic 6.0
For Each ctl In frm.Controls
Set ctl.Font = fnt
sCtlType = TypeName(ctl)
If sCtlType = "Label" Then
ctl.Caption = objLocalizer.GetResourceString(CInt(ctl.Tag))
ElseIf sCtlType = "CommandButton" Then
nVal = 0
nVal = Val(ctl.Tag)
If nVal > 0 Then
ctl.Caption = objLocalizer.GetResourceString(nVal)
End If
Debug.Print objLocalizer.GetResourceString(nVal)
nVal = 0
nVal = Val(ctl.ToolTipText)
If nVal > 0 Then
ctl.ToolTipText = objLocalizer.GetResourceString(nVal)
End If
ElseIf sCtlType = "Menu" Then
ctl.Caption = objLocalizer.GetResourceString(CInt(ctl.Caption))
ElseIf sCtlType = "TabStrip" Then
For Each obj In ctl.Tabs
obj.Caption = objLocalizer.GetResourceString(CInt(obj.Tag))
obj.ToolTipText = objLocalizer.GetResourceString(CInt(obj.ToolTipText))
Next
ElseIf sCtlType = "Toolbar" Then
For Each obj In ctl.Buttons
obj.ToolTipText = objLocalizer.GetResourceString(CInt(obj.ToolTipText))
Next
ElseIf sCtlType = "ListView" Then
For Each obj In ctl.ColumnHeaders
obj.Text = objLocalizer.GetResourceString(CInt(obj.Tag))
Next
ElseIf sCtlType = "ctList" Then
ctl.HeaderFont = fnt
Count = ctl.ColumnCount
For Index = 1 To Count
ctl.ColumnText(Index) = objLocalizer.GetResourceString(CInt(ctl.ColumnText(Index)))
Debug.Print ctl.ColumnText(Index)
Next Index
ElseIf sCtlType = "SSTab" Then
For Index = 0 To ctl.Tabs
ctl.TabCaption(Index) = objLocalizer.GetResourceString(CInt(ctl.TabCaption(Index)))
Next Index
ElseIf sCtlType = "ActiveBar" Then
Dim i As Integer
Dim J As Integer
Dim BandCount As Integer
Dim ToolsCount As Integer
BandCount = ctl.Bands.Count
For i = 0 To BandCount
ToolsCount = ctl.Bands(Index).Tools.Count
For J = 0 To ToolsCount
nVal = 0
nVal = Val(ctl.Bands(i).Tools(J).Tag)
If nVal > 0 Then
ctl.Bands(i).Tools(J).Caption = objLocalizer.GetResourceString(nVal)
End If
nVal = 0
nVal = Val(ctl.Bands(i).Tools(J).ToolTipText)
If nVal > 0 Then
ctl.Bands(i).Tools(J).ToolTipText = objLocalizer.GetResourceString(nVal)
End If
Next J
Next i
Else
nVal = 0
nVal = Val(ctl.Tag)
If nVal > 0 Then ctl.Caption = objLocalizer.GetResourceString(nVal)
nVal = 0
nVal = Val(ctl.ToolTipText)
If nVal > 0 Then ctl.ToolTipText = objLocalizer.GetResourceString(nVal)
End If
Next
When the same code is to be converted to Visual Basic 2005, i would
like to know how to access
1. ctl.HeaderFont in case of "ctList"
2. ctl.ColumnCount in case of "ctList"
3. ctl.ColumnText(Index) in case of "ctList"
4. ctl.Tabs in case of ctl is a SSTab
5. ctl.TabCaption(Index) in case of a Tab in SSTab
Any Help in this regard would be appreciated
Thanks in advance,
Sugan
Chennai
|
|
|
|
|
How do you loop through controls in a form
<br />
For Each ct As Control In Me.Controls<br />
MessageBox.Show(ct.GetType.ToString) <br />
Next
I suppose ctList and the SSTab are third party tools. so you need to create an object of ctList and SSTab to access their properties. Common properties of a control like background, name, etc can be accessed in above mentioned way. Properties like HeaderFont, ColoumnCount are specific to that Control.
So You need to create that particular object to access their properties. Here is an example, this is for the textbox and this should be same for SSTab and CtList, i guess.
For Each ct As Control In Me.Controls<br />
MessageBox.Show(ct.GetType.ToString)<br />
ct.BackColor = Color.AntiqueWhite<br />
If ct.GetType.Name.Equals("TextBox") Then<br />
Dim tb As TextBox 'here you can use SSTab or whatever <br />
tb = ct<br />
tb.BackColor = Color.Blue<br />
End If<br />
Next
|
|
|
|
|
I'm writing a program which similar outlook expess. I wish create a formatting toolbar at form "new mail". I can create it with combo box, toolbox but I think there are other ways create it. Please help me. Thank
|
|
|
|
|
Hi , i know this is stupide but can you tell me what is assembly ?? & when can we use it ?? & why ??
thnx
try to be good if you can't be the best
|
|
|
|
|
|
thnx man this really very very interesting course it is more than enough but i think without practicing it i won't understand anything of it so please if you can send me real codes of assemliese & better if you can make explanation of each statement or instrection in or else give me a vedio if you have one that explain what is that sh*t
but anyway i want to thank you very very much
if you see that what i told you abt bringing informations is really herd or diffecult you can kick that sh*t away & i will try maself
thank you
try to be good if you can't be the best
|
|
|
|
|
Hi ,
please i want to know how can i fill the list box in form1 from the list box in form2
i will give the example to make it clear :
i have a listbox in form1 & i have an other one in form two
in form1 i have a botton & also in form2
well, when i click on button in form1, form2 is shown & i do somethings in & now i have a filled listbox in form2 i want when i click on the button in form2 the listbox in form1 get filled with items i have in listbox of form2
i hope you got it cuz ma english is really stupide just do your effort to understand because this is one of the last two problems i have now to finish my application
thank you very much
try to be good if you can't be the best
|
|
|
|
|
You should create a member variable in Form2 to store all items in its ListBox. You should add items to this member variable when you click Form2's button (an OK button?). Then create a public function in Form2 that'll return this collection of items.
Public Class Form2 : Inherits Form
Private selectedItems() As Object
'
Private Sub okButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles okButton.Click
' Copy selected items to array member variable.
' This array is returned on GetSelectedItems().
ReDim selectedItems(myListBox.Items.Count - 1)
myListBox.Items.CopyTo(selectedItems, 0)
End Sub
'
Public Function GetSelectedItems() As Object()
Return selectedItems
End Function
End Class
In Form1, you would display Form2 and fetch its ListBox items like this.
Dim myForm As New Form2
Dim selectedItems() As Object
myForm.ShowDialog()
selectedItems = myForm.GetSelectedItems()
|
|
|
|
|
Hi to all,
can anyone give me a head start on following problem:
I have an applications in which I add controls to a treeview (treeview = container). The problem is that when i scroll my treeview, the nodes move but the controls stay at their place ( the don't move in other words). ANy idea on how to make them move and keep their raltive position (now they are located next to the node which handles as the controls label)
kind regards,
Bats (Mike Martin)
|
|
|
|
|
i have used check constarin like this
constraint disignation CHECK(Designation IN('Key Person','Assignee')),
when i try to enter data using my code
it,s getting error on this constrain.
in the code i have used combo box and there fixed items.i access this item using "bombobox1.selecteditem"
but i check it using msgbox and it,s giving correct word.i,m confused with this coz i have used this on vb.net 2003
now i,m using vs2005
can any one help me
my quary string is like this
"insert into Complaint values('" & cbocustomerId.SelectedItem() & "','" & cborepID.SelectedItem() & "','" & cbosource.SelectedItem() & "','" & rtxtdescription.Text & "','" & cboempID.SelectedItem() & "','" & txtdate.Text & "','" & cbocatagory.SelectedItem() & "','" & cboFtype.SelectedItem() & "' ,'" & txtvehicleNo.Text & "','" & txtbustop.Text & "','" & cboOp_dept_no.SelectedItem() & "','" & cbostatus.SelectedItem() & "','" & txtrefNo.Text & "','" & txtplace.Text & "')")
-- modified at 7:39 Monday 22nd May, 2006
|
|
|
|
|
I have make a application that the user will open a whole day,
The application contains a folder watcher, when new file created in that folder,
A event will rise.
How can I set my application at the top of screen?
I have tried me.show, me.activate, me.WindowState = FormWindowState.Maximized ...
All these cannot work properly.
|
|
|
|
|
Hi,
If you are trying to make the window as top-most accessible window you should try to load it with .ShowDialog instead of show.
batmike2000
|
|
|
|
|
Hi ,
Can anyone tell me the code (in vb.net) to delete one record from the database. I m totaly confused about it. Plz tell.
Thanks.
Swati Pathania.
|
|
|
|
|
Hi,
Do you want sql query for that.
Best Regards,
Apurva Kaushal
|
|
|
|
|
no sql query
you have to use the dataset & the table in the dataset you have that record in
& you have two ways
if you are working with rownb
well i can't explain now but it is pretty easy give me just how you fill fields from database i meant the methode or the way you follow to reward your records & i will write you how to delete it with all the necessary explanation , are you happy ?? don't be confused nobody was born knowing everything
try to be good if you can't be the best
|
|
|
|
|
Mohammed Amine wrote: no sql query
you have to use the dataset & the table in the dataset you have that record in
If you are using a dataset, what do you think the .NET Framework sends to the database? A SQL Query. So there is a SQL Query.
The OP also did not say anything about using DataSets so this solution may not be advisable in his situation.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
yeah right , but how can he show filled fields without using dataset ??
i think if he want to update on database he is obliged to use it
so i asked him for the way he use to forward or to show his records in the fields that is all
sorry i didn't want to mean no sql query just i wanted to make it easy for him
try to be good if you can't be the best
|
|
|
|
|
Mohammed Amine wrote: yeah right , but how can he show filled fields without using dataset ??
There are many ways to show data without a data set. In general I rarely use them.
Mohammed Amine wrote: i think if he want to update on database he is obliged to use it
There is no obligation to use a dataset to update a database. The dataset is often a cumbersome representation of a database inside an application that can be more efficiently replaced. I only use datasets in throw away applications that I don't intent to maintain because they come with so many constraints.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
yeah you're right but i used to use that stuff because i often work on all the database that mean i get a lot of informations from all tables in ma DB so i need that representation on the memory
try to be good if you can't be the best
|
|
|
|
|
SwatiPathania wrote: Can anyone tell me the code (in vb.net) to delete one record from the database.
You don't mention what database. So, I'll assume SQL Server.
I've also assumed you have a String called connectionString which contains the connection string to your database. And, you have a variable called primaryKeyValue that matches the primaryKey of the row in the database that you want to delete.
Dim conn As SqlConnection = New SqlConnection(connectionString)
Dim cmd As SqlCommand = New SqlCommand
cmd.Connection = conn
cmd.CommandText = "DELETE FROM MyTable WHERE PrimaryKey = @primaryKey"
cmd.Parameters.Add("@primaryKey", primaryKeyValue)
cmd.ExecuteNonQuery()
Does this help?
DISCLAIMER: I'm not a VB.NET developer there may be some minor syntactic errors, but the logic is valid
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I didn't know you can parameterize Deletes or other SQL commands. I thought it was only queries, because everyone always referred to it as "Parameterized Queries".
I learned something new today and am quite embarrassed I didn't find this out sooner.
Thanks for posting this Colin.
|
|
|
|
|
Joshua Quick wrote: I thought it was only queries, because everyone always referred to it as "Parameterized Queries".
I can see how that would be confusing if you only consider select queries as queries.
Everyting in SQL are queries, regardless if it's a select, update, delete, create table, drop table, etc. That's why the term "parameterized queries" includes any SQL command.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: Everything in SQL are queries
Yeah... that's what the 'Q' in SQL stands for.
I just never think of non-select statements that way. Afterall, I'm not asking for anything when I do an insert or a create.
Well, that's why I like to monitor these boards (and articles). Every once in a while I'll learn something new.
Now I must go punish myself by writing "All SQL commands are queries" 100 times.
|
|
|
|