|
hi all
well i m fresher in vb.net.i have prob in vb.net.
problem - how to decice client server applicion architecture.whether to use single application or two application(one for server and one for client) and how they communicate between each other.
thanks
sahil
|
|
|
|
|
I'm using HelpProvider to display a chm file on the users machine. When I view the properties of the HelpProvider, I want to specify the location of the chm file in HelpNameSpace. The chm file is written to the users application file. By default (i.e., provided the user doesn't change the install location), I know where the chm file will be (e.g., C:/Program Files/[program folder]/[filename].chm)so I can specify it in HelpNameSpace. But what if the user chooses not to install in the default location? I was hoping that the browser for HelpNameSpace would be similar to the Icon browser and would let me specify a file saved in the target application folder... but it doesn't. Can someone help?
|
|
|
|
|
Can't you use the Application's StartupPath property and set the path to the CHM file at runtime?
System.Windows.Forms.Application.StartupPath
I love it when a plan comes together
|
|
|
|
|
Hmmm... looks promising! So you're suggesting I query for Application.StartupPath and append the path to the file name of the CHMs in the application folder?
Thank you very much!
David
|
|
|
|
|
Worked like a charm! Thank you so much.
|
|
|
|
|
First I'd like to say that I've been trying to find a solution for 2 days from many resources. The code runs but only the first item in the listbox is being killed.
My textfile = "list.txt"
Contents of list.txt
notepad
wordpad
Here is a snipit of the main section of my code.
<br />
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
'Opens File Specified as .txt only<br />
Dim openFile As New System.Windows.Forms.OpenFileDialog<br />
openFile.DefaultExt = "txt"<br />
openFile.Filter = "Text documents (*.txt)|*.txt"<br />
openFile.ShowDialog()<br />
If openFile.FileNames.Length > 0 Then<br />
Dim filename As String<br />
For Each filename In openFile.FileNames<br />
' Displays path of text file to listBox1<br />
ListBox1.Items.Add(filename)<br />
'Displays content of selected text file to listBox2<br />
Dim file As New System.IO.StreamReader(filename)<br />
Dim oneLine As String<br />
oneLine = file.ReadLine()<br />
While (oneLine <> "")<br />
ListBox2.Items.Add(oneLine)<br />
oneLine = file.ReadLine()<br />
End While<br />
file.Close()<br />
Next<br />
End If<br />
End Sub<br />
Public Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
'Checks to check if items in listbox2 are selected<br />
Dim n As String<br />
n = ListBox2.Text<br />
If n = "" Then MsgBox("No Process Selected!", MsgBoxStyle.Information, "Process Not Selected")<br />
'Compares items in textbox2 against running processes, if found it kills it<br />
Dim lined As String<br />
Dim proc() As Process<br />
Dim i As Integer<br />
Dim prokill As Boolean<br />
lined = (ListBox2.Text)<br />
proc = Diagnostics.Process.GetProcesses<br />
For i = 0 To proc.Length - 1<br />
If proc(i).ProcessName = lined Then<br />
Try<br />
proc(i).Kill()<br />
prokill = True<br />
Catch ex As Exception<br />
Exit Sub<br />
End Try<br />
End If<br />
Next i<br />
<br />
'removes killed processes from listbox2<br />
ListBox2.Items.Remove(ListBox2.Text)<br />
ListBox2.SelectedIndex = -1<br />
'ListBox2.Items.Clear()<br />
End Sub<br />
I've tried adding listbox2.text to a database, but my research and small amount of experience leave me with a headache for 2 days... any help or guidance would be greatly appreiciated. Thanks.
|
|
|
|
|
r00tb0x wrote: lined = (ListBox2.Text)
proc = Diagnostics.Process.GetProcesses
For i = 0 To proc.Length - 1
If proc(i).ProcessName = lined Then
Try
proc(i).Kill()
prokill = True
Catch ex As Exception
Exit Sub
End Try
End If
You need to replace the code that takes the text from the listbox, and replace it with code which iterates through the Items property, using foreach. Then you can process each one. I'd create a KillProcess method, and call it from the loop, just to factor out the code a little.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm not sure how I would go about that. I appologize, I started learning about 4 days ago. I've had to research each section of my program and this is what I've been stuck at for 2 days. If you could maybe start me off where I need to go with it. I can run it through my head, but of course that's not how it works.. lol. Thanks again Christian...
|
|
|
|
|
Something like this:
Dim lined As String<br />
<br />
For Each lined In ListBox1.Items<br />
proc = Diagnostics.Process.GetProcesses<br />
For i = 0 To proc.Length - 1<br />
If proc(i).ProcessName = lined Then<br />
Try<br />
proc(i).Kill()<br />
prokill = True<br />
Catch ex As Exception<br />
Exit Sub<br />
End Try<br />
End If<br />
<br />
Next<br />
Next
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well I swear I tried something similar... anyhow, I thank you again! Another simple solution to a silly problem. Thanks.
|
|
|
|
|
Glad to help. I have to admit, I did not test this, but there's no reason I can see for it not to work. I typed it into the IDE, so the code itself is valid and should be correct. It's certainly how it's done, even if there's some change needed to make it work.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
By the way... YES! It worked perfectly...
|
|
|
|
|
Can anyone point me at a data bindable print document thing?
I am prepared to write this if it doesn't exist, but it's a big job so I don't want to waste time reinventing someone's wheel.
What I am looking for is a component that allows you to design a rudimentary document and then data bind to it at run time. Simple stuff: labels, paragraphs, images. (possible graphs and graphics at a later date)
Any ideas?
If such a thing does not exist any ideas as to what it should contain?
Go raibh maith agat,
Duncan
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Seems to run twice?
My code is fine if a button onclick event is used to start the sub I want but if the sub is called from the combobox onchange its a bit screwed up as it runs it twice seemingly simultaniously.
Does anyone know is there's a way to remove the control and add it back with lostfocus events?
|
|
|
|
|
Try using SelectedIndexChanged intead of onchange.
You must be careful while using onchange.
onchange will fire when the text in combo changes or if the selection changes.
Nibu thomas.
|
|
|
|
|
Hi
Thanks for that, I should have been more clear I am using that event handler but still no luck. Thanks anyway,
Nige
1000 monkeys at a 1000 computers for 1000 years = 1 working apps.
|
|
|
|
|
Did it work!
Nibu thomas.
Software Developer.
|
|
|
|
|
No Im afraid not. It would seem you must remove the event handler and add it back to stop it doing it twice - what a pain. I'm using the button to handle the event (ie change the list then press the button - what a pain!)
Ill mess with it when I have time. Thx
Nige
1000 monkeys at a 1000 computers for 1000 years = 1 working apps.
|
|
|
|
|
I'm using the DataView Find method to locate a record in a table. But it will only find exact matches in the table. i.e. If you pass the method the text "david" it will locate the row. But how can you get it to find the closest match of a text string? i.e. If you pass it the text "dav" it would find the row in the table containing the closest match, in this case the row containing "David".
Thanks
|
|
|
|
|
does LIKE work ?
where rec LIKE dav% ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In the TextChanged() of my textbox I have the following code.
If TextBox1.Text <> "" Then
Dim intRow As Integer = DataSet11.Tables(0).DefaultView.Find(TextBox1.Text)
If intRow > -1 Then
Me.DataGrid1.CurrentRowIndex = intRow
Else
Me.DataGrid1.CurrentRowIndex = 0
End If
End If
At runtime this will locate the record in the grid, but only if the textbox.text exactly matches the field in the table.
I would like the code to find the closest record that equals textbox.text.
For example, my table contains the following three records
bill
dave
david
When I type "dav" in the textbox it would find the record containing "dave".
|
|
|
|
|
|
That may work but it is not quite what I want. The perfect example of what I'm talking about is the Index Help window in VB .NET. As you type the window below increments to the closest match. It looks like they use a multi-line textbox but in my case I'm using a datagrid.
|
|
|
|
|
Hye Guys
I am USing vb.net 2003. My problem is
I have two Forms running togather and I want to run one procedure from FormA residing on Form B as a thread. but it gives me error that cannot run a thread from another thread.
Can any one help me on this issue
Rizwan Bashir
|
|
|
|
|
I think there are several ways to 'understand' you problem. I think you have two form in which you want to run a diffrent procedure :
frmA.ProcedureA() and frmB.ProcedureB()
If this is true, you can probably run ProcedureA() and ProcedureB() in seperate threads. If frmB is a child of frmA, then make sure not to open frmB as a dialog window, or make them a MDI child of frmMain or so... But once again, I don't exacly know what your problem is, can you explain a bit more to find a more accurate solution...
I love it when a plan comes together
|
|
|
|