|
Okay, I know how to control whole strings in VB .NET, but is there any way to control specific characters in a string? If so, how?
O_o
|
|
|
|
|
|
Thanks, the string.substring() really helped after I experimented with it a little bit.
O_o
|
|
|
|
|
I'd like to write a program in VB.NET that performs some actions synchronized to the music of a wav or mp3 audio file.
Something like: at 12.35 seconds into the playback a button appears, then at 45.5 seconds it disappears, etc. I'd like it to be precise and reapeatable so that at the particular beat or crescendo, something happens.
Any suggestions of how to get started?
Thanks
STEVE
|
|
|
|
|
As you know the music you are going to play and the times and events you are going to need. I reckon you want to set up a timer, add a timer to the form and then set the needed properties, start it.
With Timer1
.Start()
.Interval = 10
End With
You can then use the Timer_Tick event to do certain things at certain times, this occurs every time the interval (above) elapses in milliseconds.
i.e. Don't use this example though as you'll end up with a million msgboxs and it'll crash your pc, well it did mine.
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MsgBox("Hello World")
if timr
End Sub
This is a better choice
Dim i As Long
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With Timer1
.Start()
.Interval = 1000
End With
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
i = i + 1
If i = 5 Then
MsgBox("5 Secs")
ElseIf i = 10 Then
MsgBox("10 Secs")
Elseif i = 20 then
'reset your counter say when tune ends
i = 1
End If
End Sub
That may help, i don't really know....
"If i was king cigarettes would be free."
|
|
|
|
|
I seem to remember seeing a way to set a property of an object using a function where you pass the object and the property to be updated, and the value to set. That way you don't need to know the property at design time. Does this exist in VB6?
somefunction(object,propertynamevariable,value variable)
Thanks, Dave
|
|
|
|
|
|
Thanks! I tried every combination of search words I could think of & just could not find it!
|
|
|
|
|
|
hi i got a hand ins to make windows explorer in VB.net and i don't know how to make the program execute if i click the file in the list view screen ( right screen beside the tree view screen. For example : if i double click "a.bmp", it should execute the appropriate program to show the pic.
I don't know how to do that. anyoone can help ?
|
|
|
|
|
Check out the System.Diagnostics.Process class.
Charlie
if(!curlies){ return; }
|
|
|
|
|
There are registry entries that list file extensions & the program to run when one is opened or double clicked in windows explorer, you could duplicate that functionality with the double_click event in your code, look through those registry keys (sorry don't know exactly where to look), and run that program.
|
|
|
|
|
I am writing a class that should have the ability to modify the members of another class. I am wondering if ByRef will allow this functionality.
Thanks for any info...
|
|
|
|
|
ByRef can only be used in Sub and Function parameter passing. If ObjectB is passed to a method in ClassA ByRef, then that method can get to that instance of ObjectB.
Dim b As Integer = 23
ModifySomething(b)
Debug.WriteLine("The value of b is: " & b.ToString())
Private Sub ModifySomething(ByRef someInt As Integer)
someInt = 99
End Sub
-----8<------------------------------------------------
Output:
The value of b is: 99
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So, is the following idea permitted?
Public Class Form1
Private Function SaveObject()
Object.Save()
End Private
End Class
Public Class Object
' ... members, properties and constructors ...
Public Property DataID as Integer
' ... Get and Set the DataID
End Property
Public Sub Save()
Dim DataSaver as New ObjectDataLogic
DataSaver.Save(Me)
End Sub
End Class
Public Class ObjectDataLogic
' ... members, properties and constructors ...
Public Sub Save(ByRef Object as Object)
' ... save to the database and return get the new ID
Object.DataID = NewID
End Public
End Class
I want the data logic and the business object on two seperate tiers. Would this be considered good design or is there a better way to accomplish this? Any issues that could arise from this approach?
I am seeking any additional resources that are out there!
Thanks!
|
|
|
|
|
Passing objects byref is pointless 99% of the time. You do not need to pass byref in order to be able to modify the object properties.
It is the most misused keyword in VB, which is why the VB.NET team switched the default from ByRef to ByVal .
my blog
|
|
|
|
|
I am using VS.Net 2003 withe framework 1.1 version. But whenever i want to use the Masked Edit Control 6.0 there is a strange behaviour I face always. I mean the control can be drawn in the form, then the mask is set and next suppose I want to set the text property of it by assigning a value, the value is set to the control but the value is not displayed in the control. for example
Suppose I want to show a date field.
1. The Mask Property is : "##/##/####" (i.e. dd/mm/yyyy)
2. In the click event of a button If I write this code and
MaskEditCtrl.Text= "12/08/2004"
3. Next if i check the Text property of the control through a msgbox then it will display 12/08/2004 but the value is not displayed in the control whenever i am assigning any value, with the mask property in mind.
Please tell me what to do, or there is a defect in the software i am using. Waiting for your reply.
kunal mukherjee
|
|
|
|
|
|
I've been doing alot of research but coming up dry on strategies for implementing business rules and data access. Microsoft's patterns and practices documentation suggests seperating the actual data logic from the business class. For example, I have the following class:
Public Class TimeEntry
Private _EntryID as Integer
Private _StartTime as DateTime
Private _EndTime as DateTime
' Methods and properties to work with and expose private members
Public Sub Save()
' Save this time entry object depending on the current state of
' the application
End Sub
End Class
I want to be able to save this class either in a database (when in a connected environment) or to a data cache (xml or binary files). I am using the Data Access Application Block for SQL. However, I need the ability to connect to the database and create and update a TimeEntry object in any of the following ways:
1) Web services (for offsite connection to the database)
2) SQL Client (when onsite and connected to the local resources)
3) Data Caching/XML (when offsite and disconnected from any network)
Can anyone suggest books or articles that can introduce this concept? I have been developing primarily thin or rich clients. This is the first time I have looked into a smart client development project so I am having a difficult time grasping these concepts from MSDN.
Thanks!
|
|
|
|
|
|
|
Your specific question was about how to decouple your objects from the method used to persist them (database, web service, etc). This can be achieved in many ways, so I am uncomfortable recommending a specific approach without knowing more about your environment.
The books I mentioned (esp. P of EAA) cover the subject in detail, but they are not light reading, so I am not sure that they would help.
There are some articles on this site, in the Design and Strategy section that may help.
If you can find a good systems architect, that would probably be your best bet.
my blog
|
|
|
|
|
Hi
I have the following vb script that will query a AD group and then output the member of this group to a file. The output include the users logonname but I would also like to add the email address.
Does anyone know how to get this info?
Thanks
Andrew
>>>>>>>
Option Explicit
Dim Group, count
Dim GroupName
Dim GroupDomain
Dim Member
Dim txt
Dim oFileSys, strCurrDir, strDefaultNamingContext, oRoot, objUser
Set oFileSys = WScript.CreateObject("Scripting.FileSystemObject")
strCurrDir = oFileSys.GetAbsolutePathName(".")
' ******************************************
' Edit This for your Environment!
' ******************************************
GroupDomain = "TEST"
' ******************************************
' Find our default naming context...
Set oRoot = GetObject("LDAP://rootDSE")
strDefaultNamingContext = oRoot.get("defaultNamingContext")
Set oRoot = Nothing
GroupName = InputBox ("Group Name to list Members: ", "Enter Group Name")
If GroupName = "" Then
MsgBox("Must enter a group name!")
WScript.quit(1)
End If
Set oFileSys = CreateObject ("Scripting.FileSystemObject")
Set txt = oFileSys.OpenTextFile (strCurrDir & "\" & GroupName & " members.txt", 8, True)
Set Group = GetObject("WinNT://" & GroupDomain & "/" & GroupName & ",group")
count = 0
For Each Member in Group.Members
WScript.Echo "Finding Username " & Member.Name
On Error Resume next
Err.Clear()
Set objUser = GetObject(getLdapUN(Member.Name))
If Err<>0 Then
WScript.Echo "Error getting information for: " & Member.Name
txt.WriteLine Member.Name & vbtab & "Error - No Rights" & vbtab & "Error - No Rights"
Else
WScript.Echo "Description: " & objUser.description
WScript.Echo "Office: " & objUser.physicalDeliveryOfficeName
txt.WriteLine Member.Name & vbtab & objUser.description & vbtab & objUser.physicalDeliveryOfficeName
End if
count = count + 1
Next
WScript.Echo vbcrlf
WScript.Echo "A total of " & count & " accounts are members of the " & GroupName & " group."
WScript.Echo vbcrlf
WScript.Echo "Text file " & strCurrDir & "\" & GroupName & " members.txt" & " contains the list of users in this group."
' *************************************************
' Functions and Subroutines
' *************************************************
Function getLdapUN(strUN)
Dim oConnect, Command, strLdapQuery, Rs
getLdapUN = False
Set oConnect = CreateObject("ADODB.Connection")
Set Command = CreateObject("ADODB.Command")
'--- search for object in AD ---
strldapquery = "<ldap: "="" &="" strdefaultnamingcontext="">;" & _
"(&(objectCategory=person)(objectClass=user)(SamAccountName=" & _
strUN & "));ADsPath,cn;subtree"
oConnect.Provider = "ADsDSOObject"
oConnect.Open "Active Directory Provider"
Set Command.ActiveConnection = oConnect
Command.CommandText = strldapquery 'strSQL
Set Rs = Command.Execute 'Execute the query
'WScript.Echo "Records: " & Rs.RecordCount
If Rs.RecordCount > 0 Then
getLdapUN = rs("AdsPath")
End If
Set oConnect = Nothing
Set Command = Nothing
End Function
'~~[/script]~~
|
|
|
|
|
Exchange Server Distribution Lists, LDAP and WSH
http://rtfm.atrax.co.uk/infinitemonkeys/articles/wsh/988.asp
|
|
|
|
|
Me again!
I was wondering if anyone knew how to send a command to print a PDF file without necessarily opening it. What I want to do is print a list of PDFs when i use a button event. So my list of PDF files will be in an array, and i can just print them off one by one to my printer. It would be nice to do this in a command line or something but i cant figure out how. any ideas??? thanks for all your help with my questions lately!
megadith
|
|
|
|