|
Thanks Angus for your thoughts, however your suggestion did not unfortunately work. In the same sub I have created a new word.application with the following syntax:
Dim WordApp As Word.Application
WordApp = New Word.Application()
WordApp.Visible = True
WordApp.Documents.Open(strPath)
WordApp = Nothing
The syntax above works perfectly, opening the word doc.
Again thanks for your thoughts and ideas.
SL Culbertson
|
|
|
|
|
|
I can see that I can add a new element to an EXISTING object on the main form from a plugin:
Public Class Plugin
Inherits System.Windows.Forms.Form
Public Shared Sub addMenuItems(ByVal host As Object)
host.TabControl1.TabPages.Add(2, "MyName")
End Sub
But I can't see how to add a NEW control to the main form. This doesn't work, because the
button doesn't already exist on the main form (but I'm trying to CREATE it!) ???
Public Class Plugin
Inherits System.Windows.Forms.Form
Public Shared host.Button3 As System.Windows.Forms.Button
Public Shared Sub addMenuItems(ByVal host As Object)
host.Button3 = New System.Windows.Forms.Button
host.Add(host.Button3)
End Sub
TIA!
|
|
|
|
|
You want to add a button to a form ? Drag it from the toolbox.
Christian Graus - C++ MVP
|
|
|
|
|
Well I do want to place a new control -- button for instance -- on the main form. But I want to do it from a classlibrary .dll That's what I'm having trouble with. It seems easy to have the plugin (.dll) add elements to an object that already exists on the main form. But how to initially create a new control? I can't put the object on the main form ahead of time -- it needs to be done at runtime.
thanks
|
|
|
|
|
Hello, how can i download a file from web? I've made a code with WebClient (DownloadFileAsync),
the Progressbar i've realized with HttpWebRequest/Response, to get the size of the file...
But the problem is, that i can't download more files at one time. (New HttpWebRequest/Response is not possible)
Any ideas?? The applications shouldn't 'hang' when downloading, so i must work with DownloadFileAsync.
Thanks
|
|
|
|
|
softwarejaeger wrote: New HttpWebRequest/Response is not possible
Why do you think that?
---
b { font-weight: normal; }
|
|
|
|
|
It doesn't work easyily.
I get from the Debugger everytime an error.
|
|
|
|
|
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
The program hangs and then i get an ArgumentException Error in the Debugger, but why, what or so i don't know.
Maybe...
The Download starts in an UserControl Field, i have an list with files in a xml file and for each element, the form puts such an UserControl in a FlowLayoutPanel. In this UserControl then i have the download script. Is there any thing that couldn't be right? One download works, but a second at the same time not?!?!?!?
|
|
|
|
|
Help you with what? You haven't said anything about what the problem is!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi
some one give a button control which has two graphic cases ,, when mouse down , and when return up
thanks
jooooo
|
|
|
|
|
Sorry i typed the Address quickly ,, then sorry
jooooo
|
|
|
|
|
Gee, you asked so nicely...
There's probably one on the site, if not, it's very easy to write one.
Christian Graus - C++ MVP
|
|
|
|
|
Have you tried changing the Image property of the button in MouseDown and MouseUp events?
|
|
|
|
|
Hi
I need to add (INSERT) stock items to a SQL server Database of an ERP system. I import the new data from Excel and now need to change it to the correct data type before writing it to the server. In the ERP system documentation, for the stock table, they refer to 4 data types:
CHAR
INTEGER
DOUBLE
DATE
and after each data type, they have the length - E.g CHAR 3 for 3 charater text type field.
I have THREE questions:
1) Is there a way to do a SELECT statement, use DataAdapter.Fill and DataAdapter.FillSchema, and then display the datatypes of each column (i.e like ...GetType.Name.ToString or something?)
2) Is there a way to use the type information returned from the DataAdapter to set/cast the type of the data Imported from Excel before writing the new data into the database.
3) What are the VB.Net equivalent datatypes for CHAR 3, INTEGER 4, DOUBLE 6 DATE 8 etc.
PS I'm not too phased about the DATE, since this does not apply to my import, so that one is only for interest sake (and I always seem to struggle with dates...)
Cheers
Richard
|
|
|
|
|
Ok, I half answered my own question
I Created a new stock item using the ERP front end, then did a query to return this new item I have just created. I then looped through the columns as follows:
dtStkm is a the stock table, and dr2 is the row containing the new stock item.
<pre>
<code>
Dim dr2 As DataRow = dtStkm.Rows(0)
For i As Integer = 0 To dtStkm.Columns.Count - 1
dt.Rows(i).Item(0) = i
dt.Rows(i).Item(1) = dtStkm.Columns(i).ColumnName.ToString
dt.Rows(i).Item(2) = dtStkm.Rows(0).Item(i).GetType.Name.ToString
dt.Rows(i).Item(3) = dtStkm.Rows(0).Item(i).ToString.Length
dt.Rows(i).Item(4) = dtStkm.Rows(0).Item(i)
Next
Me.dgExcelData.DataSource = dt
</code>
</pre>
Questions:
1) Is the following returning the equivalent Vb.net datatype?: dtStkm.Rows(0).Item(i).GetType.Name.ToString
2) The Getype above returned 4 datatypes:
String (Many of these seem to be blank strings, but length = specified field len
DBNull
Double
Int32
DateTime
There are 187 fields in this table
2a) If I do an insert command, must I explicitly insert DBNULL for fields that are DBNULL, Explicitly insert Specific lenghts of Blank Strings for those that have blank strings. (it will be a HUGE INSERT Statment for 187 fields...)
2b) Will it be ok to use the datatypes that showed as a result of dtStkm.Rows(0).Item(i).GetType.Name.ToString.
2c) Since the I only need to populate 19 of the 187 fields with actual data, can anyone suggest an elegant way of doing this - perhaps pulling one row from the SQL server, then modifying the 19 fields, then writing that back?)
I am REALLY scared to insert somthing that may compromise the SQL database since this is our company's Live data...
Please help...
|
|
|
|
|
RichardBerry wrote: I am REALLY scared to insert somthing that may compromise the SQL database since this is our company's Live data...
This may sound totally stupid, but have you considered developing on a COPY of the database? That way you have a development/test database that looks like the live database, but you are free to completely bugger up when accidents happen (and they will happen).
RichardBerry wrote: DBNull
DBNull represents a null value in a database. The reason it does not return an actual null (or Nothing in VB.NET) is that in certain situations you need to be able to distinguish between nothing being returned and something being returned which happens to be null.
This means that the method you are using is not strictly correct becase the column that is returning DBNull may return some other type when the column contains a value.
RichardBerry wrote: (it will be a HUGE INSERT Statment for 187 fields...)
Yes, it will. You don't show how you intend to do the INSERT, but may I suggest that you use a parameterised query. That way .NET will handle the conversion between .NET types and the database types. All you have to worry about are the DBNull conversions - and that could be as easy as a method that takes an object and just returns that object unless it is null, in which case it returns DBNull.Value
RichardBerry wrote: 2c) Since the I only need to populate 19 of the 187 fields with actual data, can anyone suggest an elegant way of doing this - perhaps pulling one row from the SQL server, then modifying the 19 fields, then writing that back?)
Do you mean that each row contains pretty much the same data except for the 19 changed columns? Or do you mean that only 19 columns are populated and the rest are all null when the row is initially inserted?
If it is the latter, then may I suggest that you write an INSERT statement to just insert those 19 columns. For example, assume the following table has 20 columns, but only 3 need to be populated on insert:
INSERT TableName(Column1, Column2, Column3) VALUES (@value1, @value2, @value3)
|
|
|
|
|
Colin Angus Mackay wrote: This may sound totally stupid, but have you considered developing on a COPY of the database? That way you have a development/test database that looks like the live database, but you are free to completely bugger up when accidents happen (and they will happen).
OK, point taken - I should have a solution to this in a day or so, we are moving to a new server, so I will keep the old server for testing
Colin Angus Mackay wrote:
DBNull
The DBNULLS were returned on a record that is typical of all records (i.e. all our stock items do not use this field, so should be ok if a dbnull is written back for this field
Colin Angus Mackay wrote: Do you mean that each row contains pretty much the same data except for the 19 changed columns?
Yes, the values of all the fields are the same for each stock item, except for 19 fileds which are unique and contain data such as product code, standard cost, lead time etc.
Perhaps I can explain a bit about the code I have written (but NOT tested yet and you can suggest the best way of doing it)
First I create a datatable 'dtXlData' with 19 columns - datatype System.String
I then pull the Excel data into into this table.
'Import Data From EXCEL...
Dim cmd As New System.Data.OleDb.OleDbCommand("Select * from [ImportData$A:T]", conn)
Dim rdr As Data.OleDb.OleDbDataReader = cmd.ExecuteReader
Do While rdr.Read()
dr = dtXlData.NewRow
For col As Integer = 0 To 18
If rdr.IsDBNull(col) Then
dr.Item(col) = ""
Else
dr.Item(col) = rdr.GetValue(col).ToString
End If
Next
dtXlData.Rows.Add(dr)
Loop
Using above, i cannot really force different datatypes for each column, so that is why I pull everything in as String
I then pull one 'template' row from the SQL Server. This is dtStockm, and equate a datarow drStockm to a sample row from this table
I then loop through the dtXlData table and create an Insert Statement for each row of import data, alter the CommandText, and ExecuteNonQuery for each row of the new data. The code looks as follows:
Try
cn.Open()
For i = 0 To dtXlData.Rows.Count - 1
strInsertString = "stockm.on_order_qty, stockm.price, " _
& "stockm.weight, ..... to field 187" _
& "VALUES (" & dtXlData.Rows(i).Item(0) & "," _
& dtXlData.Rows(i).Item(1) & ","
& "," & drStkm.Item(0) .... to Field 187
cmd.CommandText = strInsertString
cmd.ExecuteNonQuery()
Next
From the above, you can see, that for the fields that are NOT changing, I'm using the values from the 'template' datarow (drStkm.Item(n) and for the 19 fields that DO change, I use the data from the Excel imported table (dtXlData.Rows(i).Item(n)). I think I need to still add a Ctype(drStkm.Item(n),Gettype(System.Data.Sqltypes.Chars)) for each of the 19 fields that get imported.
Is it ok to change the Command.Text while the connection is open, Or do I have to close the connection change the command text and re-open it for each row?
Is System.Data.Sqltypes.Chars the correct datatype for CHAR n?
Do you think this will work, or will a Parameterised query be easier?
Will the Datatypes of the 'Template' row be maintained and written back correctly? (I use DataAdapter.Getschema and DataAdapter.Fill when getting the 'template row from the SQL server)
Thanks for your help so far...
|
|
|
|
|
Hi
i want to make the interface of the program with two language ,,
already i designed the interface with two language by language,localizable properties ,
but how on the run mode i change the language >>
thanks for help .
jooooo
|
|
|
|
|
You may use String Tables (as a resource or a text file) and read all strings from that string table. Now to change the language, you just need to change the table from which the strings are taken!
|
|
|
|
|
Hi
thanks for response
Really , i can't do what did you tell me , but someone has told me the next line to do ,,
System.Threading.Thread.Currentculture.....("here language name")
but it donesn't work
>
jooooo
|
|
|
|
|
Hi,
We are developing windows application , I would like to know (Property or Coding) for find out the Default BOOT DISK ?.
1.If windows (OS-XP) files in C: then what is the default BOOT DISK?.
2.If windows (OS-XP) files in D: then what is the default BOOT DISK?
Thanks
Anandan k
Steadfast Technologies Services Pvt ltd.
|
|
|
|
|
The environment variable SYSTEMROOT will tell you where Windows is running from, or SYSTEMDRIVE will tell you the drive Windows is running from. Chec out the <a href="http://msdn2.microsoft.com/en-us/library/77zkk0b6(VS.80).aspx">Environment.GetEnvironmentVariable</a>[<a href="http://msdn2.microsoft.com/en-us/library/77zkk0b6(VS.80).aspx" target="_blank" title="New Window">^</a>] method to retrieve this value.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
Sub: How to find out the System BOOT Disk in Windows XP?
We have the Windows Application Developed by VB.NET.
Need: For Security purpose need to check one file in the Boot Drive.
Some Drive C: is the boot drive(Always).
Few Cases : Drive D or some one is the boot drive.
In this case how to find the System Boot Disk?
(Enviornment varible helps to find the System or Current Direcries)
In VB.NET Coding or any another way please let me know?
Advance Thanks
Anandan k
|
|
|
|
|