|
dim source as string = "This is a search"<br />
dim source2 as string = "This a atring"<br />
dim search as string = "This is"<br />
<br />
Console.WriteLine(source.IndexOf(search)) ' Prints "0" as the search exists at position 0<br />
Console.WriteLine(source2.IndexOf(search)) ' Prints "-1" as the search does not exist at all
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Dear All,
Please help me, give code on how to enumerate specific type of control in form?
Thanks
lin xen mung - Indonesia
|
|
|
|
|
foreach(Control control in myForm.Controls)
{
if(control is TextBox)
{
}
else if(control is ComboBox)
{
}
}
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
-- modified at 5:49 Tuesday 6th June, 2006 (fixed typo)
|
|
|
|
|
hi ,
please help me to get the api for hardware devices connected to system in vb6. To know the status of the scanner connected to USB.
thanks in advance,
bye.
|
|
|
|
|
Hello Friends
kindly see the code VB6 code given below
Private Declare Function concat Lib "d:\StringConcat1.dll" (ByVal Text1 As String, ByVal Text2 As String) As String
Private Sub Command1_Click()
Text3.Text = concat(Text1.Text, Text2.Text)
a = Len(concat(Text1.Text, Text2.Text))
MsgBox a
End Sub
The function of the vb code is given below. The form has three text fields
a) The first text field , enter the first string
b) The second text field , enter the second string
c) The third text field, concatation of the two string i.e result of the two strings is shown in third text field
When we call "StringConcat1.dll" dll the value entered through the two text fields is send as a argument by value to the dll and concatation of the strings is done in C++ .
the dll code is given below "test.cpp"
#include <string.h>
char* __stdcall concat(char *string1 , char *string2)
{
return strcat(string1,string2);
}
the def is given "test.def"
LIBRARY StringConcat1
EXPORTS
concat @1
When I debug the code , the Concatenation is done in C++ but when the result is given to vb code ie front only the first string that is entered in the first text is shown only as the output in the third text field.
Kindly note the point:
the C++ code works perfectly.
After computation ie Concatenation , the result is not shown in the vb code
Can any help me in this matter
From Phijo Philip
|
|
|
|
|
how can i create new theme form?
................
|
|
|
|
|
How to change title bar when javascript is alert?
................
|
|
|
|
|
Hello everyone,
Given the following HTML code on a webpage:
<td class="bdr_tl">
<input type="hidden" name="x_id" value="x1as">x1as</td>
<td class="bdr_t"><input type="text" name="x_val" value="" size="4" maxlength="4"></td>
<td class="bdr_tl">
<input type="hidden" name="x_id" value="x2a2">x2a2</td>
<td class="bdr_t"><input type="text" name="x_val" value="" size="4" maxlength="4"></td>
I want to search for each x_id (which has a unique "value") and then update the value of corresponding x_val field.
Any ideas?
|
|
|
|
|
could you explain more so we can hekp you
Tamimi - Code
|
|
|
|
|
Hello,
Sorry for not giving more info.
I have a AxWebBrowser component (wb) on the form. After clicking on a button, a specific web site is loaded in wb. On this page are various
<td class="bdr_tl">
<input type="hidden" name="x_id" value="x1as">x1as</td>
<td class="bdr_t"><input type="text" name="x_val" value="" size="4"
maxlength="4"></td>
<td class="bdr_tl">
<input type="hidden" name="x_id" value="x2a2">x2a2</td>
<td class="bdr_t"><input type="text" name="x_val" value="" size="4"
maxlength="4"></td>
entries. In my program is an array that stores a new value for each x_val field for each x_id field.
I would thus like to start at the first element in the array, search for the corresponding x_id field on the web page, and update the correct x_val field with the value in the array. This continues until the end of the array.
Some of the values in the array might not have corresponding x_id fields on the current web page.
I hope this helps
Best regards
-- modified at 4:54 Wednesday 7th June, 2006
PS I am using VB .NET 2003
|
|
|
|
|
hello friends,
i need a help!!
how to call DLL from a VB!
the DLL might be codeed in VC++!
plz give me any referece URL or detail with example
thanks in advance!
Rahul here
|
|
|
|
|
|
who can send me a Student Information Management System in vb 6.0 language ?
(use sql for the date base)
thx for advance!
初学者!Don't try it, just do it!
*Archibald*rever dragon!
|
|
|
|
|
Get real! No one is going to send you a complete system written for you in VB6.
What problems are you having with your implementation? If you let us know that we can help you out.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
Probably anyone who has passed the course you're now doing. If you want to be lazy and pass your course while remaining unemployable, www.rentacoder.com is the place to do it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi all,
i've been trying to use a module to declare my connection, which im gonna call later on my forms.
here's the code in my module:
Imports System.Data.OleDb
Module mod_con
Public con_db_ssr As OleDbConnection
Sub establish_con()
con_db_ssr = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\i1984\Automation\db_ssr.mdb;")
End Sub
End Module
--------------------------------------------------------------------------
here's the code on how iam calling it on my form(s):
con_db_ssr.Open()
--------------------------------------------------------------------------
and here's the error im gettin:
An unhandled exception of type 'System.NullReferenceException' occurred in esB_SSR.exe
Additional information: Object reference not set to an instance of an object.
can anyone help me on this?
tnx...
-::maximus::-
|
|
|
|
|
VB.net / sql
Consider a table having A - Z fields storing integer values. Therefore each record in this table will have A - Z fields. I need to find the maximum value for each record from the fields A - Z.
Can you plz help me with this.
With Best Regards,
Mayur
|
|
|
|
|
You can use SQL to get the maximum of each field by doing something like this:
SELECT MAX(A) as MaxA, MAX(B) as MaxB, ...
I've never tried it but maybe you can do an inner select that would look something like this:
SELECT MAX( SELECT MAX(A) as MaxA, MAX(B) as MaxB,...)
But if not, you could at least use the first one and then put all the values you get back into a datatable/arraylist and sort them to get the max.
Hope this helps a little.
|
|
|
|
|
Thnx Kschuler. the 1st query will give us the max value for each field. Also, the 2nd query, I am not sure if it works, may give us just one value. wat i neede is the max value of all the fields for each record. right now i am getting each field (every record) in an array, sorting it and getting the highest value from it. see the code below.
myrow = DS.Tables("psrec").Rows(0) '1 record - 24 fields
Dim myIntArray(24) As Integer
For i = 0 To 23
myIntArray(i) = myrow(i)
Next
Array.Sort(myIntArray)
maxunits = myIntArray(24)
wat leaves me stumped is that since the array starts from 0, it should end at 23. However, the maxvalue can be found at myIntArray(24). when i print the array using the code,
For i = 0 To 23
Console.WriteLine(myIntArray(i))
Next
I always get 0 for myIntArray(0) for every record and the actual values are displayed from myIntArray(1). Therefore, one value is missed since the array prints till myIntArray(23). The last value is at myIntArray(24).
Can you explain this to me...
With Best Regards,
Mayur
|
|
|
|
|
Okay. I think I got it now. I tested this out and it seems to work, hopefully it will for you too:
SELECT MAX(A, B, C, D) FROM myTable
This will return the largest value for each record. Then you won't have to worry about doing it in code.
As to why your array code wasn't working. I believe that when you declare your array as myIntArray(24) it doesn't create an array with elements of index 0 through 23. It really creates an array of elements 0 through 24. This means that you are not setting that last one, and perhaps it is defaulting to zero. Which would explain that after you sort it, the 0th element is always zero.
|
|
|
|
|
I have created a window service. It works fine.
The only problem i am facing is that when i try to stop the service then it hangs.
I have to restart the system to stop it.
Also i have created other services the same way but the problem is only with this service.
Can anyone help?
|
|
|
|
|
I've been searching for an answer for days and finally decided to ask for help. I have a VB code module that I use for common functions and procedures. In one of my procedures I process all of the session start functions (it is called in the 1st step of the Page's Load event). One of the operations I want to perform is to programmatically value the properties of the user controls that are loaded into the page. I haven't been able to find a reference that shows how to read and set the properties.
Any help or guidance would be appreciated. Thanks.
Harry
-- modified at 22:26 Monday 5th June, 2006
|
|
|
|
|
I found the answer I needed ... after much trial and error. I also realized that this message might be more appropriately posted into the ASP.NET discussion ... but too late once posted. Here was my solution which I current have working (using VB code ... but also applies to C# ... just some different coding techniques):
(1) I defined a parent class object for each of my control classes. Initially I am working primarily with my user controls ... but the same process applies to other control classes. In the parent class I inherit the control class object. Then I defined an overridable "dummy" method and properties that I want to be consistent in all of my controls.
(2) In the controls involved I inherit the parent class that I created. I also define Overrides properties and methods to match the parents.
(3) I also wrote a class that can be invoked from the page script that loops thru the entire control collection (including all of the roots) for the page to find the specific control that I am looking for. Once found, I do a CType of the parent for the control so it is of the correct type. At this point I can directly invoke the overridable method and set the properties ... which actually are the derived methods and properties of the specific control. This approach allows me to avoid using the Reflect class which in itself adds a lot of overhead on the server execution. This approach allows me to invoke a control's method or set its properties from the LOAD event of the page, before the LOAD event of the control is triggered.
Harry
Here is the code for the class that does the search and invoke:
Imports Microsoft.VisualBasic
Public Class clsIPUBFW_Utils
Private strModID As String = "clsIPUBFW_Utils"
Public Sub PostControlState(ByRef pgObj As Page, ByVal strControlsWithState As String)
Dim strProcID As String = "PostControlState"
On Error GoTo ModErrHandler
' This procedure is invoked during the start of the Page LOAD event
' determines if any controls have indicated during their INIT that they maintain state
' and if so, this procedure checks for the control and then invokes the method of the control
' that updates the controls properties from state at the start of the Page's LOAD event
' strControlsWithState is a string that has bar delimited values. The values are added by
' the control's in their INIT event if they use a state model (PGVIEW or SESSION). The format of the
' value is: statemodel - controltype - pageid { parentid : controlid }
If strControlsWithState <> "" Then
Dim objControlsWithState As Object = Split(strControlsWithState, "|")
Dim intLoop As Integer
Dim strCntlName As String
Dim strCntlType As String
For intLoop = 0 To UBound(objControlsWithState)
strCntlName = fIPUBFW_strControlName(objControlsWithState(intLoop))
strCntlType = fIPUBFW_strControlType(objControlsWithState(intLoop))
Call FindAndInvoke(pgObj, strCntlName, strCntlType)
Next
End If
Exit Sub
ModErrHandler:
Call pIPUBFW_ModuleErrorHandler(Err.Description, Err.Number, strModID, strProcID)
End Sub
Private Sub FindAndInvoke(ByRef pgObj As Page, ByVal strCntlName As String, ByVal strCntlType As String)
Dim strProcID As String = "FindAndInvoke"
On Error GoTo ModErrHandler
Select Case UCase(strCntlType)
Case "USER"
Dim cntlToSet As clsIPUBFW_UserCntl
cntlToSet = CType(GetControl(pgObj, strCntlName), clsIPUBFW_UserCntl)
' clsIPUBFW_UserCntl is the class name of the Parent control class for my User controls
cntlToSet.pPostControlStatesToProperties()
' *** AS MORE CONTROL TYPES ARE ADDED THEY CAN BE DEFINED HERE ***
End Select
Exit Sub
ModErrHandler:
Call pIPUBFW_ModuleErrorHandler(Err.Description, Err.Number, strModID, strProcID)
End Sub
Private Function GetControl(ByRef pgObj As Page, ByVal strCntlName As String) As Control
Dim strProcID As String = "GetControl"
On Error GoTo ModErrHandler
' this routine loops thru the control collection (up to 10 tiers of the family tree) to locate
' the desired control that is assumed to be present in the collection
Dim i1, i2, i3, i4, i5, i6, i7, i8, i9, i10 As Integer
Dim cntlWrk1, cntlWrk2, cntlWrk3, cntlWrk4, cntlWrk5, cntlWrk6, cntlWrk7, cntlWrk8, cntlWrk9, cntlWrk10 As Control
Dim strParentID As String = ""
Dim strControlID As String = ""
Dim intPrt As Integer = InStr(strCntlName, ":")
strParentID = Left(strCntlName, (intPrt - 1))
strControlID = Right(strCntlName, (Len(strCntlName) - intPrt))
GetControl = Nothing
If pgObj.HasControls Then
For i1 = 0 To pgObj.Controls.Count - 1
cntlWrk1 = pgObj.Controls(i1)
If PageControlFound(cntlWrk1, strParentID, strControlID) Then
GetControl = cntlWrk1
Exit Function
End If
If cntlWrk1.HasControls Then
For i2 = 0 To cntlWrk1.Controls.Count - 1
cntlWrk2 = cntlWrk1.Controls(i2)
If PageControlFound(cntlWrk2, strParentID, strControlID) Then
GetControl = cntlWrk2
Exit Function
End If
If cntlWrk2.HasControls Then
For i3 = 0 To cntlWrk2.Controls.Count - 1
cntlWrk3 = cntlWrk2.Controls(i3)
If PageControlFound(cntlWrk3, strParentID, strControlID) Then
GetControl = cntlWrk3
Exit Function
End If
If cntlWrk3.HasControls Then
For i4 = 0 To cntlWrk3.Controls.Count - 1
cntlWrk4 = cntlWrk3.Controls(i4)
If PageControlFound(cntlWrk4, strParentID, strControlID) Then
GetControl = cntlWrk4
Exit Function
End If
If cntlWrk4.HasControls Then
For i5 = 0 To cntlWrk4.Controls.Count - 1
cntlWrk5 = cntlWrk4.Controls(i4)
If PageControlFound(cntlWrk5, strParentID, strControlID) Then
GetControl = cntlWrk5
Exit Function
End If
If cntlWrk5.HasControls Then
For i6 = 0 To cntlWrk5.Controls.Count - 1
cntlWrk6 = cntlWrk5.Controls(i6)
If PageControlFound(cntlWrk6, strParentID, strControlID) Then
GetControl = cntlWrk6
Exit Function
End If
If cntlWrk6.HasControls Then
For i7 = 0 To cntlWrk6.Controls.Count - 1
cntlWrk7 = cntlWrk6.Controls(i7)
If PageControlFound(cntlWrk7, strParentID, strControlID) Then
GetControl = cntlWrk7
Exit Function
End If
If cntlWrk7.HasControls Then
For i8 = 0 To cntlWrk7.Controls.Count - 1
cntlWrk8 = cntlWrk7.Controls(i8)
If PageControlFound(cntlWrk8, strParentID, strControlID) Then
GetControl = cntlWrk8
Exit Function
End If
If cntlWrk8.HasControls Then
For i9 = 0 To cntlWrk8.Controls.Count - 1
cntlWrk9 = cntlWrk8.Controls(i9)
If PageControlFound(cntlWrk9, strParentID, strControlID) Then
GetControl = cntlWrk9
Exit Function
End If
If cntlWrk9.HasControls Then
For i10 = 0 To cntlWrk9.Controls.Count - 1
cntlWrk10 = cntlWrk9.Controls(i10)
If PageControlFound(cntlWrk10, strParentID, strControlID) Then
GetControl = cntlWrk10
Exit Function
End If
Next
End If
Next
End If
Next
End If
Next
End If
Next
End If
Next
End If
Next
End If
Next
End If
Next
End If
Next
End If
Exit Function
ModErrHandler:
Call pIPUBFW_ModuleErrorHandler(Err.Description, Err.Number, strModID, strProcID)
End Function
Private Function PageControlFound(ByRef cntlObj As Control, ByVal strParentID As String, ByVal strCntlID As String) As Boolean
Dim strProcID As String = "PageControlFound"
On Error GoTo ModErrHandler
' this routine checks for an ID match on the parentID and controlID within the page control collection
Dim strColCntlID As String = ""
Dim strColParentID As String = ""
Dim blnOut As Boolean = False
If Not cntlObj Is Nothing Then
strColCntlID = cntlObj.ID
strColParentID = cntlObj.Parent.ID
' check for ID match ... if so execute the control`s post state method
If UCase(strColParentID) = UCase(strParentID) And UCase(strColCntlID) = UCase(strCntlID) Then
blnOut = True
End If
End If
PageControlFound = blnOut
Exit Function
ModErrHandler:
Call pIPUBFW_ModuleErrorHandler(Err.Description, Err.Number, strModID, strProcID)
End Function
End Class
|
|
|
|
|
I am using VB6 and mysql for database, just wanna ask what ADODB property im going to use to know if my program is connected to the database? Please help me
|
|
|
|
|
I am using VB 2003.net
I have a field that I want to have the ability fill in a great about of data, but not take up the whole screen.
On the form I have a small text box "Quote_Note" that Shows 5-6 lines of my typed test. For ease of typing and to see a whole screen when typing. I am opening a new form "Text_Box" that is one large text box called Quote_Note.
Private Sub QUOTE_NOTE_ENTER(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QUOTE_NOTE.Enter
Dim TEXT_BOX As New TEXT_BOX
TEXT_BOX.QUOTE_NOTE.Text = QUOTE_NOTE.Text
TEXT_BOX.Show()
End Sub
Issue 1)How do I get the data back to my calling form Quote.Quote_note.text from TEXT_BOX.Quote_note.text
2) When I tab into Quote.Quote_note.text and it opens TEXT_BOX.Quote_note.text I get a cursor
but if I mouse click on Quote.Quote_note.text I do not? Any Ideas.
|
|
|
|
|