|
That depends on the object returned by Name. It should be a string, but could also be Nothing or some other object. The only way to attempt a conversion is to wrap it in a CStr() function call.
Dim name = CStr(objItem.Name)
|
|
|
|
|
How do I determine the output directory of a project (the place where temporary files are extracted)?
Many thanks!
|
|
|
|
|
Your question doesn't make any sense. A "projects" output, when compiled, ends up in the bin folder under your project's folder.
When an installer unpacks itself, the files can go either in a folder hard coded into the installer, or one of the Temp folders, like C:\TEMP, C:\TMP, C:\Windows\Temp, ...
What are you trying to do with this ability?? Is this code that's running in an installer as a custom action??
|
|
|
|
|
Change it in the project properties, it can dictate which folder the files are stored in, and you can set where you want the compiler to output the debug and exe files
|
|
|
|
|
This one really has me stuck. Like the subject says, I would like to open a word document that is an embedded resource in my vb.net application.
Up to now I have been able to open a new document with automation:
oDoc = oWord.Documents.Add
or open an existing doc on my hard drive:
oDoc = oWord.Documents.Open("path and filename")
I have little clue, however, how to successfully refer to an embedded document and open that with word automation. Ideally, I would like to do this without actually saving the embedded doc to the user's hard drive first (if possible).
Thanks for your help,
Craig
modified on Wednesday, December 05, 2007 11:45:43 AM
|
|
|
|
|
Can't be done. In order for Word to open the document, it MUST be a file on a drive. It does not have the ability to open a file from a resource, nor a .NET stream object.
The only way I could think of that simulates this, would be to come up with your own script that tells your code how to build a new Word document.
|
|
|
|
|
assuming a little different situation, but you´ll get the point:
picBox.Image = My.Resources.ResourceManager.GetObject("smq")
and for writing a ressource to a file:
Dim x() As Byte
Dim bw As New BinaryWriter(New FileStream("c:\fwd.doc", FileMode.CreateNew))
bw.Write(x)
modified on Wednesday, December 05, 2007 12:29:35 PM
|
|
|
|
|
Hi,
Can I connect with visual basic.net to a online server (I have a space on the server with my hosting company, the server has mySQL database on it.)?
The idea was to totally wok online using mySQL server?
Thanks.
|
|
|
|
|
Sure. Exactly how you do that depends entirely on where you're code is going to be running and how your ISP exposes the MySql server to it.
You can get the MySql data providers classes from here[^].
You can also find a pretty good tutorial on using it here[^].
|
|
|
|
|
hi all
I am using vs.net 2003 with access.I Usng <b>Crystal Reports </b>in my project.I made my setup but i don't know which additional files I have to add for crystal repots.Can anyone helpme.When I am Installing app to client machine it get error "KeycodeV32.dll not registerd".Is the probelm is due to setup ???
Plz give me full details how to include crystal reports in setup.
Its urgent.
thanks in advance
poonam
|
|
|
|
|
Hi,
While creating the setup of your application, right click on Application Folder and Add -> Assembly to the Folder.
It will open .NET assemblies window. Select all the crystal-report related assemblies.
When u will build the setup project u will obtain a installer for crystal reports. First install this setup and then install your application.
This should work.
Regards,
Ujjaval Modi
|
|
|
|
|
hi
the error was solved.But I have new problm.When I am deploying the project on client machine all things work good.Only crystal report has a problem.It gives error "Load Report Failed".I wrote the code on CRV
[code]
crv.ReportSource = "..\Reports\enq.rpt"
[/code]
hw can i solve this type of prblm.
poonam
|
|
|
|
|
Hi,
Even I am not much good at crystal reports but even I faced same problem in my application for crystal reports and I learnt to add its Installer, so I helped you out in it.
Regarding this problem, your Logon to database is failing, thts why your report fails to load.
Try this code :
<br />
<br />
dim rptObject as new ReportObject <br />
rptObject.SetDatabaseLogon(username,password)<br />
rptObject.SetDataSource(dataTableObject)<br />
crv.ReportSource = rptObject <br />
<br />
Here rptObject is an object of your "enq.rpt" report.
Regards,
Ujjaval Modi
Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.
|
|
|
|
|
Hello All,
I have an application, in which I use also DataGridViews to display data. When the user modifies (delete, modify or add) a column he cann save the data by clicking on a button.
Code :
Private Sub btnToeveoegenBewolkingLicht(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
Me.BewolkingBindingSource.EndEdit()
Catch ex As Exception
MessageBox.Show(ex.Message, "Fout bij schrijven data")
End Try
Me.SaveDataBewolking()
Try
Me.LichtBindingSource.EndEdit()
Catch ex As Exception
MessageBox.Show(ex.Message, "Fout bij schrijven data")
End Try
Me.SaveDataLicht()
'ResetControls()
End Sub
In SaveDataBewoling() I check if there are any changes and when so the tableadaper is updated.
Code :
Friend Function SaveDataBewolking() As Integer
'Hier IsUpdating
Dim rowsSaved As Integer = 0
Try
If Me.CarpDataSet.HasChanges Then
rowsSaved = BewolkingTableAdapter.Update(CarpDataSet.Bewolking)
End If
Catch ex As Exception
End Try
Return rowsSaved
End Function
Everything seems to be working OK, but ...... there is no data saved in the files. The new/mod data cann bee seen in the gridview, but the data is not being written to the database.
Maybe one of you cann help me solving this problem. I must be overlooking something but what ?!
Thnxs
|
|
|
|
|
Hello
please can you tell me how you are adding rows in datagrid because i have problem to add the data into the rows every time rows is inserted on to the top index 0 and data is not displayed
|
|
|
|
|
Using the debugger, step through the code in the SaveData... methods, line-by-line. Check to make sure that your If statement with the HasChanges check returns what you think it does. If HasChanges returns false, then you can get the symptoms you're describing.
When you write code, you can not assume you know that every line is doing. You have to verify that each line is behaving like it should, even if you think you know what it's doing.
If HasChanges works, step through the code in the TableAdapters Update method. It's possible that the code doing the update is wrong somehow.
|
|
|
|
|
Hi Dave
Thnxs for your reply.
I am sertain that HasChanges=True. The statement RowsSaved returns the number of rows that have changed, deleted or inserted.
Maybe a foolish question, but the TableAdapter.Update statement, does it directly execute the update of the database?
In my dataset i have an sql-statement that has generated automatically the needed statements for update, inserting etc ....
Thanks
Hans
|
|
|
|
|
zwaailicht wrote: Maybe a foolish question, but the TableAdapter.Update statement, does it directly execute the update of the database?
Yes, it does.
zwaailicht wrote: In my dataset i have an sql-statement that has generated automatically the needed statements for update, inserting etc
Did it autogenerate the SELECT command, or all of the commands?? Does your database table have a Primary Key?? If not, then you've got a problem where no changes can be made to the database.
|
|
|
|
|
Hi Dave,
All the statements auto autogenerate (select, update, delete, insert).
And Yes each file as an unique key.
Greet
Hans
|
|
|
|
|
Hi guys, how do I install an added merge module in my setup project (vb 2005)? I have 2 merge modules the other one is a windows service, how can i register (installutil service.exe) and start the automatic service soon after installation without the user having to do the manual DOS staff(i mean going to the command prompt and typing ....\installutil ...\service.exe and restarting the machine or having to go to the services list and starting it there)?
thanks in advance
|
|
|
|
|
Override the Commit method of your Installer class and, in that code, use the ServiceController class to start your service.
|
|
|
|
|
Hi all,
I m using datatable.compute method in my application but it not works properly.
In my data table there is feild run (value are 99 and 100).
<br />
Dim datatable As New DataTable<br />
datatable = mydataset.table(0)<br />
<br />
minimum_run = 0<br />
If Not (datatable.Rows.Count = 0) Then<br />
minimum_run = Val(datatable.Compute("MIN(run)", ""))<br />
End If<br />
It gives minimun_run is 100
I don't know what's wrong with my code,Can anyone tell where i m wrong?
Thanks with anticipaton
|
|
|
|
|
Hi,
Please try the following code and if this helps.
Dim datatable As New DataTable
datatable = mydataset.table(0)
Dim minimum_run as Integer = 0
If Not (datatable.Rows.Count = 0) Then
minimum_run = CType(datatable.Compute("MIN(run)", ""), Integer)
End If
I hope this would be helpful.
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
John_Adams wrote: minimum_run = CType(datatable.Compute("MIN(run)", ""), Integer)
That would change the type of the result, but it doesn't change how the values in the data table are compared.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
The first two lines of your code should read:
Dim dataTable As DataTable = mydataset.Tables(0)
What your original code did was create a new instance of a DataTable object, then immediately abandon it and point the datatable variable at an already existing instance of another DataTable object.
|
|
|
|