|
I do not think you will see any changes since your progress bar is most likely not being updated as you expect. You need to create a background thread that updates the control as your application progresses or processes some data.
|
|
|
|
|
Did you set the "marquis" style?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I set the marquis to De Sade but that just hurt the program!
My .style setting is "continuous" which only gives a solid colour with no "fly by".
|
|
|
|
|
i'm trying to locate a file inside a textbox (full path i.e. "I:\movie collections\Gigantic - 2008 - Zooey Dechanel.mp4" = MovieURLTextbox.text) and display it in windows explorer. below code works fine with short filenames but would go to the default mydocuments with long filenames. please help... thnx!
Dim fileToFind As String
fileToFind = MovieURLTextBox.Text
Call Shell("explorer /select," & fileToFind, AppWinStyle.NormalFocus)
modified 4-Oct-15 2:58am.
|
|
|
|
|
What does this mean, exactly?
Member 12029698 wrote: but would go to the default mydocuments with long filenames
Did you try putting quotes around the long filename?
fileToFind = """" & fileToFind & """"
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
thnx...
I meant with long filenames, the code would take me to "my computer" (not "my documents", my bad);
e.g.
I:\movie collections\Me and Earl and the Dying Girl - 2015 - Thomas Mann, RJ Cyler, Olivia Cooke.mkv
while, "I:\movie collections\Gigantic - 2008 - Zooey Dechanel.mp4" will do as the code is intended
|
|
|
|
|
I think it's the presence of the "comma" in the path... I tried removing the "comma" and the code works fine.
|
|
|
|
|
finally made it worked with code below;
Dim filePath As String = MovieURLTextBox.Text
Try
Process.Start("Explorer.exe", "/n,/e,/select, """ & filePath & """")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
looks like process.start and the double quotes on the file path was the solution to my problem.
hope this can help others too...
|
|
|
|
|
Good day friends! I need your help in this issue. I know vb6 is outdated but this has to be done in vb6. I add ms access database to a resource file in my vb6 app but am finding it difficult to add new record, search the database, delete record from it etc. How can I achieved this in vb6 resource file. Thanks in advance!
|
|
|
|
|
You cannot use an Access database from inside a resource in any language at all.
An Access database MUST be a file on disk in order to be usable. The user running the code must also have Read and Write access to the database file in order to work.
|
|
|
|
|
|
I have two workbooks that I am working with. I am trying to copy a range of cells from one workbook to another. The source workbook will already be open and the destination workbook might not be open all the time. I am a little new at VBA. I have looked at some code from different sources on this topic. This is what I have so far.
I get the following Compiler Error: Invalid use of property
This happens when trying to open the destination workbook.
Sub export_data()
'
'
'Delcare variables
Dim xlApp As New Excel.Application
Dim xlworkbook1, xlworkbook2 As Excel.Workbooks
Dim xlworksheet1, xlworksheet2 As Excel.Worksheets
Dim xlSourceRange, xlDestRange As Excel.Range
'Set the source workbook
xlworkbook1 = xlApp.Workbooks.Open("C:\Users\Michael\Documents\Greystone\GDI Line\Holey Paper Templates\Denso GDI Holey Paper Rev 5.xls")
'Open destination workbook
xlworkbook2 = xlApp.Workbooks.Open("C:\Users\Michael\Documents\Greystone\GDI Line\Denso GDI (Hitachi Templates 7.9.2015)\Hitachi 1.xlsm")
'Display Excel
xlApp.Visible = True
'Set the source active worksheet
If xlworksheet1 = Worksheets("GDI Connector").Activate Then
xlworksheet1 = xlworkbook1.Sheets("GDI Connector")
Else
xlworksheet1 = xlworkbook.Sheets("GDI Core")
End If
'Set the destination worksheet
xlworksheet2 = xlworkbook2.Sheets("Export")
'Set the source range
xlSourceRange = xlWorkSheet.Range("F1:F120")
'Set the destination range
xlDestRange = xlWorkSheet.Range("B34")
'Copy and past the range
xlSourceRange.Copy = (xlDestRange)
'
Application.Goto Reference:="export_data"
ActiveWorkbook.Save
End Sub
Any help would be much appreciated.
|
|
|
|
|
Haven't had a chance to check this out yet but could it be
Dim xlworkbook1, xlworkbook2 As Excel.Workbooks - The Open method returns a Workbook not a Workbooks collection.
|
|
|
|
|
That was not it. Thanks for the suggestion. I am getting a "Runtime error 13" Type Mismatch on the line Set xlWorkSheet1 = ActiveWorksheet
There are 2 possible worksheets that could be the active one so I am trying to check which one is currently active.
Function GetThisWB() As String
GetThisWB = ThisWorkbook.Path & "\" & ThisWorkbook.Name
End Function
Public Sub export_data()
'
'
'Delcare variables
Dim xlApp As New Excel.Application
Dim xlWorkBook1 As Excel.Workbooks
Dim xlWorkBook2 As Excel.Workbooks
Dim xlWorkSheet1 As Excel.Worksheets
Dim xlWorkSheet2 As Excel.Worksheets
Dim xlworksheet3 As Excel.Worksheets
Dim xlSourceRange As Excel.Range
Dim xlDestRange As Excel.Range
'
'Set source workbook as active
'
'Display Excel
xlApp.Visible = True
''Set the source active worksheet
'
If Worksheets("GDI Connector").Activate = True Then
Set xlWorkSheet1 = ActiveSheet
ElseIf Worksheets("GDI Core").Activate = True Then
Set xlWorkSheet2 = ActiveSheet
End If
'Set the source range
xlSourceRange = xlWorkSheets.Range("F1:F120")
xlSourceRange.Copy
'Open workbook 2 and set the destination worksheet as active
Workbooks.Open ("C:\Users\Michael\Documents\Greystone\GDI Line\Denso GDI (Hitachi Templates 7.9.2015)")
xlworksheet3("Export").Select
'Set the destination range
xlDestRange = xlWorkSheets.Range("B34")
'Copy and paste the range
xlDestRange.PasteSpecial
'
Application.Goto Reference:="export_data"
ActiveWorkbook.Save
End Sub
|
|
|
|
|
Again, ActiveWorkSheet returns a WorkSheet object but you have defined
Dim xlWorkSheet1 As Excel.Worksheets
|
|
|
|
|
I have a problem in my programming class. A person gets paid daily, day one is 1 penny, day two is 2 pennies, day three is 4 pennies, day five is 8 pennies and so on doubling each day. I wrote the following code but am having an issue with out put. When I put in 1 day it tells me 2 pennies instead of 1. I am sure this is an easy fix but my brain is fried and I am overlooking it.
Here is my code:
Public Class Form1
Private Sub calculateButton_Click(sender As Object, e As EventArgs) Handles calculateButton.Click
Dim intDays As Integer
intDays = 1
Dim decPennies As Decimal
decPennies = 0.01
For intDays = 1 To cboDays.Text
decPennies = decPennies * 2
Next intDays
ansLabel.Text = decPennies.ToString("C")
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For intDays = 1 To 20
cboDays.Items.Add(intDays)
Next
End Sub
End Class
Any help would be greatly appreciated.
|
|
|
|
|
For intDays = 1 To cboDays.Text
decPennies = decPennies * 2
For ... 1 To 1 will do this once, so you get your pennies as 2. You need to rethink the loop type, maybe a better idea would be to use While ... End While[^].
|
|
|
|
|
Look at powers of 2 - also - are you tring to find the number of pennies they are paid on a particular day, or the total number of pennies they have on that day?
For intDays = 1 To cboDays.Text
decPennies = decpennies + 2^(intdays-1)
next
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Chris Quinn wrote: For intDays = 1 To cboDays.Text
decPennies = decpennies + 2^(intdays-1) next
No loop is required at all!
The total is just:
decPennies = 2^Val(cboDays.Text) - 1
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G.K. Chesterton
|
|
|
|
|
Hi today i am wondering how to disable user's from accessing or changing the windows desktop background from where only an admin can change them and i need to know how to put this code into my application so when a user clicks a button they automatically change the privileges to admin so that guests on the computer cant change the desktop background or personalize it without putting in the admins user name and password.
|
|
|
|
|
First, bad idea. Why? Because a user cannot grant more permissions to something than they themselves have.
Second, you don't need code for this at all. You need Active Directory and Group Policy. You can force down a background image or whatever else you want and the restrictions so that the user cannot change it.
Lastly, background settings like this are user policies, not system. All users who log into the same machine get to set their preference for a background. What one user sets does not apply to another.
|
|
|
|
|
|
I'm working on a API, in which you can't get a fake answer back from the test server, so you have to use the production server. On top of that, if you use the same tracking number too many times, it's shuts you off.
So I thought I'd just create a XML file as an embedded resource in my DLL, and just load it and parse it. So I'm loading this XML file, and I want to turn it into a SOAP response, so I can finish writing the code to parse it. I had a problem with getting rid of the BOM marker, so I converted it to a string, so I can rewrite it as an object.
Now I get a error in XML, Line 2,2
Maybe this is more trouble than it's worth. Maybe I misssed something here, like serializer.
Public Shared Function BloomingtonCA() As trackService.TrackReply
Dim serializer As XmlSerializer = Nothing
serializer = New XmlSerializer(GetType(trackService.TrackReply))
AddHandler serializer.UnknownNode, AddressOf serializer_UnknownNode
AddHandler serializer.UnknownAttribute, AddressOf serializer_UnknownAttribute
Dim fileStream As Stream = Assembly.GetExecutingAssembly.GetManifestResourceStream("FedExCorp.bloomingtonCA.xml")
Dim bytes As Byte() = New Byte(fileStream.Length) {}
fileStream.Position = 0
fileStream.Read(bytes, 0, fileStream.Length)
Dim rxn_string As String = Encoding.UTF8.GetString(bytes).Replace("???", "")
Dim rxnStream As New IO.MemoryStream
Dim utf8 As Encoding = New UTF8Encoding()
Dim writer = New XmlTextWriter(rxnStream, utf8)
writer.WriteRaw(rxn_string)
writer.Flush()
rxnStream.Position = 0
Dim reader = New StreamReader(rxnStream)
Dim rateReply As New trackService.TrackReply()
rateReply = CType(serializer.Deserialize(reader), trackService.TrackReply) 'XML Error here
If Not (reader Is Nothing) Then reader.Close()
Return rateReply
End Function
<?xml version="1.0" encoding="utf-8" ?>
<TrackReply xmlns="http://fedex.com/ws/track/v10" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<HighestSeverity>SUCCESS</HighestSeverity>
<Notifications>
<Severity>SUCCESS</Severity>
<Source>trck</Source>
<Code>0</Code>
<Message>Request was successfully processed.</Message>
<LocalizedMessage>Request was successfully processed.</LocalizedMessage>
</Notifications>
|
|
|
|
|
This is more trouble than it's worth.
I'll just hand code it and test over a several weeks.
|
|
|
|
|
I've written a program to play internet radio streams using an embedded Windows Media Player. It works fine but sometimes the title of the track currently playing is wrong. e.g. "Emerson, Lake and Palmer" will be displayed as "Emerso" - the string being terminated at the character before the first comma.
I use
AxWindowsMediaPlayer1.currentMedia.getItemInfo("Title")
to get the title information and if it doesn't contain a comma, it's fine.
I'm guessing this is a problem with WMP as using the standalone program shows the same error.
Is there any way around this problem or can someone suggest another media player I could embed to play radio streams?
|
|
|
|