|
Hi All,
Iam using ShellExecute API function to execute the file.
File may be any type.
I want to get the Process ID(PID) of the particular file which i executed.
I already tried Shell command, but it isn't work.
Thanks & Regards
Kumaran
|
|
|
|
|
Process.Start will return the handle. Assuming this is VB.NET.
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 Graus.
but i need in vb6
Thanks & Regards
Kumaran
|
|
|
|
|
I need to add the item and value in the list box. I add this using strtext and strvalue respectively.
But the strvalue i need to add is a string. so that the value when adding cannot get duplicated.
How can i add string value to strvalue
I am taking this values from two textboxes
My coding is as follows....
Dim i As Integer
Dim item As New Item
For i = 0 To ListBox1.Items.Count - 1
item = ListBox1.Items(i)
If TextBox1.Text = item.strValue Then
MsgBox("Already you have added this link", MsgBoxStyle.Information, "Knowledge Base")
Exit Sub
End If
Next
item.strText = Textbox2.Text
item.strValue = TextBox1.Text
lstLinks.Items.Add(item)
txtWebLinkDescriptions.Text = ""
txtWebLinks.Text = ""
It shows that the string value cannot be bind to integer value....
May u help me to solve these please....
Thanks in advanvce........
|
|
|
|
|
Hi,
I think this code will help you...
Dim i As Integer<br />
<br />
For i = 0 To ListBox1.Items.Count - 1<br />
<br />
If ListBox1.Items(I).Tostring = TextBox1.Text Then<br />
MsgBox("Already you have added this link", MsgBoxStyle.Information, "Knowledge Base")<br />
Exit Sub<br />
End If<br />
Next<br />
<br />
lstLinks.Items.Add(TextBox1.Text)
Thanks,
Nanda
|
|
|
|
|
Thank u for ur response Nanda
But, my question is how to get the value of the item in case of string
ie, since because the value i use here is a string, it displays error
as "Conversion from string to type integer is not valid"
will u please tell me how to get the string value for the item
ie, i need to use string value for item.strvalue
Thank u once again
|
|
|
|
|
The easy way is to build a dictionary where the key is the strValue, or just a list of strings, even. Do a search, if the value is in there, then it's been added already.
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 )
|
|
|
|
|
Hi,
I am getting the 'Type initializer error' in module1 (for eg see the below code). The thing is i want to get the value from the dll which is added as a reference to this exe, where the value is declared in the module. Please Review the below code and suggest/help me.
Project1.dll
Module Module1<br />
Public MyPath As String = "C:\Nanda"<br />
End Module
Public Class Class1<br />
<br />
Public Sub Query()<br />
MsgBox(MyPath, MsgBoxStyle.Information, "Project1")<br />
End Sub<br />
<br />
End Class
Project2.exe
Public Class Form1<br />
<br />
Public MyReport As New Project1.Class1<br />
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
MyReport.Query()<br />
End Sub<br />
End Class
Thanks,
Nanda
|
|
|
|
|
Nanda1605 wrote: MsgBox(MyPath, MsgBoxStyle.Information, "Project1")
Try this:
MsgBox(Module1.MyPath, MsgBoxStyle.Information, "Project1")
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi guys
My problem is this . I need to generate a large number of records from SQL server 2000 to and excel spreadsheet. However the durations of time id too long. For about 900 records there's about 40 min.
Any idea or guide to boast up the speed?
i am generating to excel .xls
Basically i have a main details table link to many sub details Table
Then first i select all the main info id and use the for loop to loop through all the sub details table whether the id is match. then insert into the excel spreadsheet. The method i use is Create the XLS file then connect to it and do insert statement to input data. This method work but when inserting 900 records it took about 30 mins or more....
Any suggetion or solution please guide.... Need help man
Thanks a million guys need it urgently
KaKaShi HaTaKe
KaKaShi HaTaKe
|
|
|
|
|
Unless you REALLY need to create an actual .XLS file I would recommend creating a .csv file and letting excel convert it when it is opened. This eliminates all the VBA stuff and you should be able to do 900 rows in under 1 sec.
There are plenty of article/examples on CP
|
|
|
|
|
What's a CP?
KaKaShi HaTaKe
|
|
|
|
|
The only way you can speed this process up is by using another method:
1. take one of the output excel files and save it as XML
2. open the XML file with your code editor (Visual Studio I suppose?)
3. see what the file's structure looks like
4. adapt the following sub to your file's structure, and content, and to whatever other specific requirements you have:
Public Sub DatasetToExcel(ByVal ds As DataSet, ByVal ExcelPath As String, Optional ByVal Title1 As String = "", Optional ByVal Title2 As String = "")<br />
If File.Exists(ExcelPath) = True Then<br />
If MsgBox("Tiedosto on jo olemassa. Haluatko korvata sen?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then<br />
File.Delete(ExcelPath)<br />
Else<br />
ExcelPath = InputBox("Muuta nimi: ", "Tiedosto olemassa", ExcelPath)<br />
End If<br />
End If<br />
'use .xls even though its an xml file<br />
Dim doc As New StreamWriter(ExcelPath)<br />
Try<br />
Dim startExcelXML As String = ""<br />
startExcelXML &= "<xml version="">"<br />
startExcelXML &= vbNewLine & "<workbook xmlns="" urn:schemas-microsoft-com:office:spreadsheet="" hold=" /"> startExcelXML &= vbNewLine & Microsoft.VisualBasic.Chr(10) & "" + " xmlns:o=""urn:schemas-microsoft-com:office:office"""<br />
startExcelXML &= vbNewLine & "xmlns:x=""urn:schemas- microsoft-com:office:" + "excel"""<br />
startExcelXML &= vbNewLine & "xmlns:ss=""urn:schemas-microsoft-com:" + "office:spreadsheet"">"<br />
<br />
'write the styles tags that format the data and cells properly<br />
startExcelXML &= vbNewLine & "<styles>"<br />
<br />
startExcelXML &= vbNewLine & " <style ss:id="" default="" ss:name="" normal="">"<br />
startExcelXML &= vbNewLine & " <alignment ss:vertical="" bottom="" />"<br />
startExcelXML &= vbNewLine & " <borders />"<br />
startExcelXML &= vbNewLine & " <font />"<br />
startExcelXML &= vbNewLine & " <interior />"<br />
startExcelXML &= vbNewLine & " <numberformat />"<br />
startExcelXML &= vbNewLine & " <protection />"<br />
startExcelXML &= vbNewLine & " </style>"<br />
'Title style<br />
startExcelXML &= vbNewLine & "<style ss:id="" title="">"<br />
startExcelXML &= vbNewLine & "<alignment ss:horizontal="" center="" ss:vertical="" bottom="" />"<br />
startExcelXML &= vbNewLine & "<font x:family="" swiss="" ss:size="" 12="" ss:bold="" 1="" />"<br />
startExcelXML &= vbNewLine & "</style>"<br />
'Column header style<br />
startExcelXML &= vbNewLine & "<style ss:id="" colheader="">"<br />
startExcelXML &= vbNewLine & "<alignment ss:horizontal="" center="" ss:vertical="" bottom="" />"<br />
startExcelXML &= vbNewLine & "<font x:family="" swiss="" ss:color="" #ffffff="" ss:size="" 10="" ss:bold="" 1="" />"<br />
startExcelXML &= vbNewLine & "<interior ss:color="" #969696="" ss:pattern="" solid="" />"<br />
startExcelXML &= vbNewLine & "</style>"<br />
'Row style<br />
startExcelXML &= vbNewLine & " <style ss:id="" reg="">"<br />
startExcelXML &= vbNewLine & " <font x:family="" swiss="" ss:bold="" 0="" />"<br />
startExcelXML &= vbNewLine & " </style>"<br />
<br />
startExcelXML &= vbNewLine & "</styles>"<br />
'write the header to the file<br />
doc.WriteLine(startExcelXML)<br />
'write one sheet per table<br />
For Each tab As Data.DataTable In ds.Tables<br />
Dim sheetname As String = "<worksheet ss:name="<br mode=" hold=" /"> sheetname &= Microsoft.VisualBasic.Chr(34)<br />
sheetname &= tab.TableName.Trim<br />
sheetname &= Microsoft.VisualBasic.Chr(34)<br />
sheetname &= ">"<br />
With doc<br />
.WriteLine(sheetname)<br />
.WriteLine("<table>")<br />
.WriteLine("<row>")<br />
<br />
'write a title line<br />
If Title1 = "" And Title2 = "" Then<br />
Else<br />
.Write("<cell ss:styleid="" title=""><data ss:type="" string="">")<br />
.Write(Title1)<br />
.WriteLine("</data></cell>")<br />
.Write("<cell ss:styleid="" title=""><data ss:type="" string="">")<br />
.Write(Title2)<br />
.WriteLine("</data></cell>")<br />
.WriteLine("<row>")<br />
End If<br />
<br />
'write the column headers<br />
For Each col As DataColumn In tab.Columns<br />
.Write("<cell ss:styleid="" colheader=""><data ss:type="" string="">")<br />
.Write(col.ColumnName)<br />
.WriteLine("</data></cell>")<br />
Next<br />
.WriteLine("</row>")<br />
<br />
'write the table<br />
For Each row As DataRow In tab.Rows<br />
.WriteLine("<row>")<br />
For i As Integer = 0 To tab.Columns.Count - 1<br />
.Write("<cell ss:styleid="" reg=""><data ss:type="" string="">")<br />
.Write(row.Item(i))<br />
.WriteLine("</data></cell>")<br />
Next<br />
.WriteLine("</row>")<br />
Next<br />
.WriteLine("</row></table>")<br />
.WriteLine("</worksheet>")<br />
End With<br />
Next<br />
doc.WriteLine("</workbook>")<br />
doc.Close()<br />
Catch Ex As Exception<br />
doc.Close()<br />
EC(Ex)<br />
End Try<br />
End Sub</xml>
5. Good luck.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
i'm using microsoft visual studio. i want to update my table. how to update a field?
i have a table that have 2 field 1. run_number 2. date. each time i add my input it will update the running no and date.. so i can know that input is the 2nd or 3rd input that i've key-in on that day. and the current running number i will have it in my document number that is in this format <yyyymmdd><custid><run_no>. This doc number is for my reference. i hope i explain it well because my english is not that good. somebody pls help me..
|
|
|
|
|
A table in a database ? You need the unique Id and then just write SQL that will update the record in question, and call it using ADO.NET.
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 )
|
|
|
|
|
thank you for ur reply.. i'm sorry if ask a very stupid question. actually i've just got promoted as a programmer. before this i'm just a computer operator (execute program from programmer in main frame). it has been 3 years after my studies in computer science and i've never got a job related to my study.. i'll try to do what u've suggested. thanks again for entertaining my question.
|
|
|
|
|
No worries - you should find there's plenty of examples online. Ask again if you get stuck.
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 )
|
|
|
|
|
Hi all,
I would like to create a list of cities that are associated with the country flag that I would use in a combo box or list view. I have tried with the Imagelist but you cannot associate it with a word ?
Thanks,
|
|
|
|
|
You'd use a dictionary to associate two groups of objects, probably storing the city name as the key and the index into your image list as the value.
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 )
|
|
|
|
|
Hi all,
I am a beginner in VB 2005 and I am looking for some help.
I am creating a application that will use a small database under the form of a txt file (called *.dat). Here is an example :
ServerName;IP Adress; port_number; etc....
1) How can I update automatically my listview or checkbox with this information as I do not want it to be hard coded?
2) Also I would like to store the parameters (or Options that the user as entered via the application) in an *.INI file and be able to read them at the launch of the application so that I can populate the options fields?
I know that it is an old way of proceeding but easier for me to maintain.
Thanks,
|
|
|
|
|
1 - you'd do better to store your data as XML, or, at least, create a struct that represents one data item, and write code to build a list of items from your data file. Then make that the data source of your control.
2 - Sounds good. Again, XML is probably easier to work with. Then all you need to do, is read the file and set your state from it on startup, and store your state to XML on close.
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 )
|
|
|
|
|
I want to insert checkbox in a listbox for selecting purpose
Ahmed hassan
|
|
|
|
|
there is already a control CheckedListBox in VB 2005 & 2008 (not sure about earlier .net versions)
Eslam Afifi
|
|
|
|
|
Does anyone have experience calling a Cobol/DB2 stored procedure from .NET? It is not an easy thing to find on the web as I'm sure most companies have tried to get away from this. We still have them because they must serve as the link between our distributed apps and an IMS Database
|
|
|
|
|
How do you write a stored proc in Cobol ? If you have a database, then it needs to support ODBC in order to create a link to ADO.NET. Otherwise, it's going to be tough going, I reckon.
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 )
|
|
|
|