|
Are you saying that you're looking to create an object from ANY window handle, even if your app didn't create the window?
It doesn't work that way. You can't create an object for a window that the .NET Framework didn't create.
And I made th comment I did because your question is impossible to understand with any certainty. It's also why I'm asking more questions about your questions. We need clarification!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 7:38 Sunday 26th February, 2006
|
|
|
|
|
What I mean with "The code isn't work in VB not .NET" is the code that you wrote isn't work in VB6 and the code that I wont is in VB6 not in VB .NET, sorry if it become a little mis-Understanding. Why I want to try it in VB6 so deeply, because in MSDN I saw the code like you wrote, but the defferent is that code in MSDN is wrote in VC6. If I not wrong the code is something like this:
...
oThing = FromHandle(hWnd)
... So I wondering if any way to do that in VB6?
"Untuk tumbuh itu tak perlu kerja keras
Tapi untuk menjadi bijaksana perlu kerja sangat keras"
Ghoib
|
|
|
|
|
No, there isn't. VB6 cannot create Form wrapper objects around windows that were not created under the VB6 Runtime.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can anyone help with this. . . I am creating an application using an MDI form. The child form displays fine when I select the menu option. However, I do have two issues.
1) If I select the menu option a second time - a second form is displayed. I want to limit this to only one instance of this particular form.
2) If I close the form and click on the menu option, the next instance of the form does not appear in the same spot. It appears slightly below where the previous form appeared.
Here is a snipet of the code. . .
Private Sub mnuAdminTradeManager_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAdminTradeManager.Click
'Declare new Trade Manager form
Dim frmTradeManager = New frmTradeManager
'Set the child forms MdiParent property
frmTradeManager.MdiParent = Me
'Show Trade Manger
frmTradeManager.Show()
End Sub
Thank you
|
|
|
|
|
Hi,
Try this (it can be used for all the child form)..
Private Sub mnuAdminTradeManager_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAdminTradeManager.Click<br />
<br />
Dim frmTradeManager As frmTradeManager<br />
<br />
frmTradeManager = IsOpen("YourFormName")<br />
If frmTradeManager Is Nothing Then<br />
frmTradeManager = New frmTradeManager()<br />
ShowForm(frmTradeManager)<br />
Else<br />
ShowForm(frmTradeManager, True)<br />
End If<br />
<br />
End Sub<br />
<br />
Private Function IsOpen(ByVal formName As String) As Object<br />
Dim intChildCount As Integer<br />
For intChildCount = 0 To Me.MdiChildren.Length - 1<br />
If Me.MdiChildren(intChildCount).Name = formName Or Me.MdiChildren(intChildCount).Text = formName Then<br />
Return Me.MdiChildren(intChildCount)<br />
End If<br />
Next<br />
Return Nothing<br />
End Function<br />
<br />
Private Sub ShowForm(ByRef DisplayForm As Form, Optional ByVal isOpened As Boolean = False)<br />
Try<br />
DisplayForm.MdiParent = Me<br />
DisplayForm.WindowState = FormWindowState.Maximized<br />
If isOpened = False Then<br />
DisplayForm.Show()<br />
Else<br />
ActivateMdiChild(DisplayForm)<br />
End If<br />
<br />
Catch exc As Exception<br />
Throw exc<br />
Finally<br />
End Try<br />
<br />
End Sub
I hope this will help u......
Regards,
Ritesh
|
|
|
|
|
Hi ,
Is it possible to use Indexed text box, bcz I want to do some manipulations like when enter some numbers into text box (Some grid like) I want to calculate the average and upper n lower limits like that..
Thnx
Jr
|
|
|
|
|
There's no such thing as an Indexed TextBox, or what used to be, in VB6, a control Array. You can simluate such things yourself. All you need to do is add all the TextBoxes to your own array.
Dim textboxes(10,10) As TextBox
For i As Integer = 0 to 9
For j As Integer = 0 to 9
textboxes(i,j) = New TextBox()
With textboxes(i,j)
.Location = New Size(blah, blah)
' keep setting properties for your TextBoxes...
End With
' Don't forget to add each TextBox to the Form's
' Controls collection, otherwise you'll never see it!
Me.Controls.Add(textboxes(i,j))
Next
Next
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I was wondering if anyone knows a link to a walkthrough for a chatroom client in VB.NET/ASP.Net
Regards,
Maurader
|
|
|
|
|
There's dozens of examples of this type of app. All you have to do is Google[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
please go through the following code...i'v tried to apply the disconnected mode using dataset and data adapter...it's givng an error of this fashion...
"System.DataUpdate requires a valid Insertcommand when passed DataRow collection with new row" for the da.update command in addcmd_click event......please help
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Documents and Settings\Administrator\Desktop\exp_mod\exp.mdb;"
cn.ConnectionString = con
dao = New OleDbDataAdapter("select * from exp_mas_bank", cn)
dao.Fill(ds, "bank")
End Sub
Private Sub addcmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addcmd.Click
Dim drs As DataRow = ds.Tables("bank").NewRow
drs(0) = cdtxt.Text
drs(1) = nmtxt.Text
drs(2) = addtxt.Text
ds.Tables("bank").Rows.Add(drs)
Try
dao.Update(ds, "bank")
Catch ex As Exception
MsgBox(ex.Source & ex.Message)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ds.Tables("bank").Rows(0)("code") = ds.Tables("bank").ToString & " ***"
Try
cn.Open()
dao.Update(ds, "bank")
cn.Close()
Catch ex As Exception
MsgBox(ex.Source & ex.Message)
End Try
End Sub
|
|
|
|
|
Hi kamalika,
Before calling dao.Update to insert/update or delete data from Dataset to database you have to set the dao.InsetCommand,dao.UpdateCommand and dao.DeleteCommand property with approriate command
Regards,
Ritesh
|
|
|
|
|
|
Hello All,
I'm at work trying to write a Test Case script to run in VB6. The test case needs to test many many different combinations of parameters. For example, let's say I have 12 parameters, and I need to test the available types of data types that the parameters can take. Let's say that each parameter has 4 data types. I need to test every possible combination of every data type and parameter. If I were to do ALL of them, I would end up running over 20,000 test cases!!! However, with Pairwise testing, which only picks out the best possible combinations needed, the number of test cases dramatically reduces to about 25 or so. This software is available out on the net to get this result (www.satisfice.com), however, it must be run in DOS mode or through the command line. This makes my automation a problem, where a manual step must be taken to retrieve these combinations.
The idea looks like this...
Param1 Param2 Param3 Param4 ...
1 1 1 1
2 2 2 2
3 3 3 3
My question is...
Is there anyone out there that knows of, or knows where to find, an algorithm that can calculate the PairWise pairings? It could be in VB6 or VB.NET, I'll know how to convert the two.
Any insight or ideas would greatly help me.
Thank you for your time.
Matthew Hlavacek
Software Test Engineer - MCP
-- modified at 15:46 Friday 24th February, 2006
|
|
|
|
|
|
Hello again, just another question.
I've created a solution which contains an executable and a DLL. I want this DLL to be registered during installation. I create an installation project and drop the executable, which in turn carries along the DLL. To test the installation process, I create another folder in Common Files to hold the DLL, and I mark the DLL with the Register option to COM and COMRelativePath (I have tested both). But when I test the installation on a machine other than my development one, the DLL seems not to be registered. In fact, if I use gacutil on that machine after installation, everything works as expected.
What have I been missing?
Thanks in advance and best regards,
Juan Pedro Pérez
|
|
|
|
|
I have never in my life coded any Visual basic before the last few days, I am more of a C kinda guy, so I wonder if somebody could help me a little with some of my functions.
I am creating an ActiveX dll which is to be used with a C project of mine. The purpose of this dll is to perform all my Excel needs. I am having trouble getting the following to work:
Public Function CloseFile(FileName As String, Save As Boolean)
xlApp.Workbooks(FileName).Close savechanges:=Save
End Function
Whenever I call it I am confronted with a message box displaying "Subscript out of range".
Also with the following:
Public Function GetCellString(RowId As Integer, ColId As Integer) As String
GetCellString = xlSheet.Cells(RowId, ColId).Value
End Function
Most of the cells containing floating point numbers, but for simplicity I am returning a string. Problem is, I am only getting the whole number (before the decimal point) instead of a float.
Any help would be greatly appreciated.
|
|
|
|
|
waldermort wrote: xlApp.Workbooks(FileName).Close savechanges:=Save
This line doesn't make any sense.
I'm guessing "savechanges" is a member variable. It should be on the next line.
Also, the colon ':' allows you to write 2 lines of code on the same line. It turns 2 lines of code like this...
Dim index As Integer<br />
index = 1
And allows you to do this...
Dim index As Integer : index = 1
I don't think that was your intent. Although the := reminded me of Pascal. Ahhh... memories.
So, did you mean to do this?
xlApp.Workbooks(FileName).Close<br />
savechanges = Save
waldermort wrote: GetCellString = xlSheet.Cells(RowId, ColId).Value
I'm guessing that property "Value" is not returning a float. Otherwise, VB would have converted it to a floating point string for you.
Are there any other properties/functions that you can call?
|
|
|
|
|
|
I stand corrected. I've never seen := in VB before. Must be some kind of special syntax because it's not documented in any of my books.
I'm also thinking that your xlApp.Workbooks(FileName) is not returning a WorkBook object, which is why you're getting an exception.
|
|
|
|
|
Excel Spreadsheets determine the datatype of a column, by looking at
the content of the first few rows. If it determines that the column is text,
then all numeric cells/fields are returned as null and if the column is
determined as numeric, then all text fields are returned as null.
Divya Rathi
|
|
|
|
|
I determined that the function itself is causing the problem. You say that the datatype is determined by the first few rows. The first 2 rows and first column of this file contain text, the rest is composed entirly of floating point numbers. From this function:
Public Function GetCellString(RowId As Integer, ColId As Integer) As String
Dim val As Double
val = xlSheet.Cells(RowId, ColId).Value
MsgBox val
GetCellString = xlSheet.Cells(RowId, ColId).Value
End Function
|
|
|
|
|
My code now looks like this
Public Function GetCellString(RowId As Integer, ColId As Integer) As String
If VarType(xlSheet.Cells(RowId, ColId).Value) = vbString Then
GetCellString = xlSheet.Cells(RowId, ColId).Value
ElseIf VarType(xlSheet.Cells(RowId, ColId).Value) = vbDouble Then
GetCellString = CStr(xlSheet.Cells(RowId, ColId).Value)
End If
MsgBox GetCellString
End Function
It is detecting a double, but it is only converting the numbers before the decimal point.
|
|
|
|
|
How do I get the contents of the current field and row from a datagrid?
I have set up the code to run when I click on a record in the datagrid and this works until you sort the datagrid by clicking on the column headers.
dim test as string
test = TestGrid.CurrentRowIndex
COMPANY.Text = CODE_DataSet.Tables(CODE_TABLE).Rows(test).Item(0)
Any Idesas?
|
|
|
|
|
|
There is an ItemCommand event that fires when you click something in the datagrid
one of the arguments for that event is DataGridCommandEventArgs let's call it "e"
myItemCommand (object sender, DataGridCommandEventArgs e )
{
e.Item.DataItem[0]; /*This a DataRowViewRow*/
}
That is how you access a row in a datagrid.
Please let me know if I missunderstood your question or there's anything else I can help you with.
Greetings,
Felipe
|
|
|
|