|
Win wrote:
Is there anyway that I can find out whether the sheet(s) has any protection?? what if I don't know the password??
err..... sorry, don't know much in that area.
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Hi,
I've created a .net Windows forms user control that is housed within IE. All the methods of the usercontrol work fine, but I can't get the events to filter through to IE.
I've read quite a bit about both the new event model in .net and how you need to explicitly create an interface in order to expose events to COM, however, after trying all sorts of examples, I just can't get it to work.
The code currently looks like (having removed the system generated code):
====================================================================
Option Explicit On
Option Strict On
Imports System
Imports System.Runtime.InteropServices
'Public Delegate Sub newCallDelegate(ByVal URN As Integer)
'Step 1: Define an event sink interface (ButtonEvents) to be
'implemented by the COM sink.
<guidattribute("a59b958d-b363-454b-88aa-be8626a131fb"), _
interfacetypeattribute(cominterfacetype.interfaceisidispatch)=""> _
Interface WebflowEvents
Event newCall(ByVal URN As Integer)
End Interface
'Step 2: Connect the event sink interface to a class
'by passing the namespace and event sink interface
'("EventSource.ButtonEvents, EventSrc").
<classinterface(classinterfacetype.none)> _
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
Implements WebflowEvents
Public Event newCall(ByVal URN As Integer) Implements WebflowEvents.newCall
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("Firing")
RaiseEvent newCall(1234)
End Sub
End Class
=================================================================================
I REALLY need to get this to work, otherwise it's back to registration of a COM wrapper.
thanks
Graham
|
|
|
|
|
I have a complicated question, so if i dont explain it properly, or dont supply enough information, please let me know! I have 3 datacombos - 1 for product type and 2 for price Descriptions. for each combo, i wish to populate a column in the datagrid. for the first column, products are populated based on the product type chosen and prices are populated (relating to the products) based on the price descriptions chosen. This would be fine if it was only the product type and 1 of the price combos that i was using but the fact that i am using 2 price descriptions. ( i am using the same fields for comparison purposes). is there anyway i can get around this - my SQL statement isnt working( due to the fact that teh same field is being used twice). do i need to use 2 Adodcs? is it possible to populate a column of the datagrid from a SQL statement? you will see the relationship between the tables here:
Product Type: TypeCode, TypeDescription
Product: ProductCode, ProductDescription, TypeCode
Price: PriceCode, ProductCode, Price
PriceDescription: PriceCode, PriceDesc
Any help would be greatly appreciated!
|
|
|
|
|
I have a requirement in my application where in i have to dynamically add properties to the propertygrid control.
Now i am creating a class with private members having public get & set methods and then assigning the instance of the class to the selectedobject method of the propertygrid. now i want to add another property at runtime. say for example on click of a button on the form is there any way
Thanx for your help
|
|
|
|
|
I just start to work with VB.NET and i designed a form that allows me editing customer records.
The code is as follows :
Private Sub BindingFields()
con = MyConnection.GetHandler()
Mydataset = New DataSet()
MyAdapter = New SqlClient.SqlDataAdapter("select * from client", con)
MyBuilder = New SqlClient.SqlCommandBuilder(MyAdapter)
MyAdapter.Fill(Mydataset, "client")
TextBox1.DataBindings.Add(New System.Windows.Forms.Binding("Text", Mydataset, "client.r01_codcli"))
TextBox2.DataBindings.Add(New System.Windows.Forms.Binding("Text", Mydataset, "client.r01_adrcli"))
TextBox3.DataBindings.Add(New System.Windows.Forms.Binding("Text", Mydataset, "client.r01_tel1"))
TextBox4.DataBindings.Add(New System.Windows.Forms.Binding("Text", Mydataset, "client.r01_nomcli"))
TextBox5.DataBindings.Add(New System.Windows.Forms.Binding("Text", Mydataset, "client.r01_tel2"))
TextBox6.DataBindings.Add(New System.Windows.Forms.Binding("Text", Mydataset, "client.r01_fax"))
TextBox7.DataBindings.Add(New System.Windows.Forms.Binding("Text", Mydataset, "client.r01_datcre"))
TextBox10.DataBindings.Add(New System.Windows.Forms.Binding("Text", Mydataset, "client.r01_remcli"))
CheckBox1.DataBindings.Add(New System.Windows.Forms.Binding("checked", Mydataset, "client.stop_serv"))
'da.Fill(Mydataset, "Categorie")
'ComboBox1.DataSource = Mydataset
'ComboBox1.DisplayMember = "categorie.libelle"
End Sub
and the code of the AddNew button is as follows :
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AddRecord()
End Sub
'This routine add a blank record
Private Sub AddRecord()
Mode = "A"
Try
Me.BindingContext(Mydataset, "client").EndCurrentEdit()
Me.BindingContext(Mydataset, "client").AddNew()
TextBox1.Text = Getautocode()
TextBox4.Focus()
Catch eEndEdit As System.Exception
System.Windows.Forms.MessageBox.Show(eEndEdit.Message)
End Try
End Sub
Someone can tell me for why the fields don't become empty when i click on the addnew button .
whereas, when i disabled the line :
CheckBox1.DataBindings.Add(New System.Windows.Forms.Binding("checked", Mydataset, "client.stop_serv"))
the code works correctly.
Thank you very much.
***
|
|
|
|
|
i am trying to perform form validation on my Order Generation form. In testing for a valid quantity, i use the following if statements
ElseIf (Me.txtQuantity.Text = "") Then
MsgBox "Please enter a value for Quantity"
ElseIf Val(iQuantity) = 0 Then
MsgBox "Please enter a value for Product code"
ElseIf IsNumeric(iQuantity) = False
MsgBox "Please enter a value for Product code"
However, is doesnt seem to recognize these statements as when i dont enter a value for quantity, a message box should pop up but instead i hit a runtime error saying "type mismatch"...why is this - is there anything i can do about it? Thank you in advance!
|
|
|
|
|
I'd recommend the following:
- create a local variable based on a Trim() of the txtQuantity.Text
- check length first
- next, check for a false on IsNumeric()
- only then look for certain integer values
HTH limit further bugs
btw, which line are you getting the type mismatch from?
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
my svg article
|
|
|
|
|
Here is a basic structure of my code:
Private Sub cmdConfirm_Click()
With Adodc3.Recordset
Do Until .EOF
.MoveFirst
Call Save(iOrderNo, strCode, strDesc, iQuantity, iFullPrice)
.MoveNext
Loop
End With
Function Save(iOrderNo As Integer, strCode As String, strDesc As String, iQuantity As Integer, iFullPrice As Integer) as boolean
.....validation statements and inserts
If Val(DataGrid2.Columns("Quantity").Value) > RS("Quantity").Value Then
Call BackOrder(strCode, strDesc, iQuantity)
End If
Save = True
Function BackOrder(strCode As String, strDesc As String, iQuantity As Integer) As Boolean
....validation and inserts
BackOrder = True
To step through the code briefly, when the command button is pressed, a save function is called (for each row in the datagrid), which performs the necessary validation and saves to the database, this also calls another function - BackOrder, which enters products in a backorder if necessary. I hope the information given is sufficient, and if not, please let me know. The problem occurs when the project is run, there must be something wrong with the loop as it runs through the first row twice, upon which a bug is thrown, without ever moving onto the next row...why is this - how can i make it run through all the rows? Thank you so much - any help would be greatly appreciated!
|
|
|
|
|
mcm wrote:
Do Until .EOF
.MoveFirst
Call Save(iOrderNo, strCode, strDesc, iQuantity, iFullPrice)
.MoveNext
Loop
This code:- Moves to the first record;
- Saves the record;
- Moves to the next record;
- Goes back to the start of the loop;
- Tries to move to the first record;
- Throws an error because you have a forward-only recordset;
Change the loop to:
Do Until .Eof
' TODO: Get these values from the recordset!
Call Save(iOrderNo, strCode, strDesc, iQuantity, iFullPrice)
.MoveNext
Loop
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
hi,
i want to know whether i can use scrrun.dll in vc++(either in mfc or win32 console).if yes can anyone provide me a sample code for this?if no can u pls explain the reason?
Actually i wanted to use the ReadLine Property of scrrun.dll in vc++ either in mfc or win32 to access a text file.
shankar prasad D.R
|
|
|
|
|
I wrote a Multithread ARCNET-Driver in VC++. It receives Data Packets from the NullStackDriver. My VB6 Application opens an controls the Driver. So far so good.
The VC++ DLL is managed by serval Events (CreateEvent(), SetEvent(); ResetEvent(); WaitForSingleObject()...)
On receiving a Complete DataPacket i would like to send a additional Event ex. EVENT_RX to signalize my VB6 that it can read the Packet from the Queue and prozess it.
How can I make my VB6 Application to react on this EVENT_RX ?
Thanks for any Inputs!
|
|
|
|
|
I used to use the sourcesafe as my source control software in previose version of Visual Studio. What is used now with the .NET for source control?
If it is the Sourcesafe, what version (I found in my MSDN version 6)?
Thanks
Ilan
|
|
|
|
|
Visual Studio.NET can use VSS also. You should use 6.0c (which is the version that came with VS.NET Enterprise) since, if I remember correctly, it had some file types changes that help it work with VS.NET. 6.0c should be in the MSDN disks...
|
|
|
|
|
I have a program that plays multiple WAVS at the same time. What I cant figure out how to do is adjust the volume levels and panning for each individual WAV during playback. The only info Ive found is about changing the master WAV device volume. Can someone shed some light on how I can change the volumes and pans of individual WAV files (all of which are playing through the main WAV device output)?
Thanks!
Emil
|
|
|
|
|
Hello, I have the following problem: A class with a property called MyCollection which is, obviously, a collection. The collection MyCollection contains items of type MyItemCollection:
MyClass
property: MyCollection as CustomCollection
CustomCollection
property: MyItemCollection as SecondCustomCollection
Now, I designed custom editors for both "SecondCustomCollection" and "CustomCollection". They both work perfectly, but... When using the collection editor for MyCollection, I click "Add Item" and a new MyCollection item is created. The next step would be to call the editor for the MyItemCollection by pressing a button. That button should programatically call the editor for the second class... This is where I got stuck... Look:
cd is the MyItemCollection:
Dim tp As Type = cd.GetType ' I get it's type
Dim ac As AttributeCollection = t.GetAttributes(tp) ' I get it's attribs
Dim ed As EditorAttribute = CType(ac(GetType(EditorAttribute)), EditorAttribute) 'I get the editor
If Not ed Is Nothing Then ' found it?
Dim te As TypeEditors.ColumnDefCollectionEditor ' this is the editor type
te = New TypeEditors.ColumnDefCollectionEditor(GetType ColumnDefinition.ColumnDefinitionCollection))
Now, the logical call to edit the value would be:
cd = te.EditValue(context, provider, cd)
to launch the editor with the current object and return the same object with the changes.
The place I got stuck is finding the context and the provider. Here is what I tried:
Dim sv As System.ComponentModel.Design.ServiceContainer = New System.ComponentModel.Design.ServiceContainer()
sv.AddService(GetType(IWindowsFormsEditorService), Me)
te.EditValue(cd.GetType, sv, cd)
But it does not work... I get an error at AddService first of all...
So, my question is how can I get the IServiceProvider and the ITypeDescriptorContext required to programatically call my custom editor?
Any help would be appreciated!
Thank you,
Best Regards,
Iulian
|
|
|
|
|
i have performed validation and populated a datagrid via a command button and using a "pseudo" (temporary) table called OrderDetails2. Now I wish to save the details to the proper table (ie OrderDetails), as every row in the datagrid as to be looped through to achieve this, I am using this code:
Dim iRowCount As Integer
'Dim row As Integer
iRowCount = Adodc3.Recordset.RecordCount
For DataGrid2.row = 0 To iRowCount
Call Save
Next row
the code in the save function is:
Dim iOrderNumber As Integer
iOrderNumber = RS.Columns("OrderNo")
Dim strProductCode As String
strProductCode = RS.Columns("ProductCode")
Dim strProductDesc As String
strProductDesc = RS.Columns("ProductDesc")
Dim iProductQty As Integer
iProductQty = RS.Columns("Quantity")
Dim iOrderPrice As Integer
iOrderPrice = RS.Columns("Price")
Dim nSQL As String
'inserting the order into order detail
nSQL = "Insert Into OrderDetail (OrderNo, ProductCode,ProductDesc, Quantity, Price) " & _
" Values (" & iOrderNo & ", '" & strCode & "', '" & strDesc & "', " & iQuantity & ", " & iFullPrice & ")"
Set RS = Conn.Execute(nSQL)
however, when run, a compile error is thrown "variable required - can't assign to this expression" (referring to the datagrid.row)
what can i do to fix this or is there any different way to can achieve the same functionality? Thanking you!
|
|
|
|
|
Set RS = Conn.Execute(nSQL)
I think the above statement is the problem ..
you execute a statement that inserts data in a table and does not return a recordset ..
try using :
Conn.Execute(nSQL)
|
|
|
|
|
similiar to the manner in which you can have a click/LostFocus/GotFocus etc event with textboxes, is there anyway you can have a "tab event" in a specific column of a datagrid? (ie when tabbed across, an action happens in another column)? Thanking you!
|
|
|
|
|
i need to scroll using my middle button using a mouse in a combo box,but i'am unable to do so.please can any one find a solution.
|
|
|
|
|
|
|
Ok, you need to use the API function "SendMessage" (i.e. SendMessageA). I suggest you download the API Guide (Do a search on API Guide on the Internet).
The Scrollbar works by sending the WM_VSCROLL message. Now, you'll have to SubClass the Window you want to handle the Wheel Mouse on. You can do this by intercepting the WM_MOUSEWHELL Message. Again, all this is contained in the API Guide. If you need an example of SubClassing, I can help but I don't have a lot of time to explain it. Also, Subclassing is 100 times easier to do in .NET than VB6.
After you have the WM_MOUSEWHEEL intercepted, just pass the message for it to scroll Up or Down by passing a "0" or "1" to the LParam of the SendMessage (it's either that or the WParam, can't remember off the top of my head).
Call SendMessage(lstBoxHandle, WM_VSCROLL, 1, 0)
Call SendMessage(lstBoxHandle, WM_VSCROLL, 0, 0)
Not all those who are lost are looking to be found. But of those who are lost and those who are found, all are looking for something higher than themselves.
|
|
|
|
|
The function of my form is to generate an order. i am doing this by populating several rows of a datagrid. I have little experience with datagrids and i wish to save the contents of the datagrid, having gone through several validations (eg ensure every cell has been filled out, is there enough quantity in stock etc). i am wondering how to loop through each row of the datagrid, first to validate and then to save each row to the database? is it something like:
for row 1 to ? ( i am unsure of what to put here as the number of rows that will be in the order cannot be predetermined)
perform validation and saving......
next row
how do i declare the rows in the datagrid?
any help would be much appreciated! Thank you!
|
|
|
|
|
Hi,
I have two applications that i have developed, both of these applications need to run in the background as a windows service when ever windows boots up and a user logs in.
Can anyone point in the write direction, i.e. articles or samples, that will help me to achieve this.
Many thanks in advance
Regards
Neil
|
|
|
|
|
|