|
Aamir Mustafa wrote: but this is loading albums and photos again and again
Of course it is, you have put your load in the for loop:
For i = 1 To 100 Step 6
ProgressBar1.Value = +i
Dim objAlbums As New Albums()
treeAlbum.Nodes.Clear()
Using oReader As SqlDataReader = objAlbums.GetAlbumsAndPhotos()
etc
next
To make your progress bar work properly you need to update it in the reader bit:
While oReader.Read()
do all your code and update progress bar
You may want to consider a background thread to keep the UI responsive.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Look at this picture:
http://img24.imageshack.us/img24/4117/clipboard02ca4nj6.png
My usercontrol has its own designer, which inherits from Windows.Forms.Design.ControlDesigner.
Maybe i can override some properties or something? :P
|
|
|
|
|
Sub ShutDown(sNodes, sAction)
Dim sNode, oWMI, colOperatingSystems, obj, oOS, iCMD, nERR, objShell
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8
For Each sNode In Split(sNodes, ",")
Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & sNode & "\root\cimv2")
Set colOperatingSystems = oWMI.ExecQuery("Select * from Win32_OperatingSystem")
For Each obj In colOperatingSystems
Set oOS = obj: Exit For
Next
sAction = LCase(sAction)
Select Case sAction
Case "logoff"
iCMD = EWX_LOGOFF
Case "logoff_force"
iCMD = EWX_LOGOFF + EWX_FORCE
Case "shutdown"
iCMD = EWX_SHUTDOWN
Case "shutdown_force"
iCMD = EWX_SHUTDOWN + EWX_FORCE
Case "reboot"
iCMD = EWX_REBOOT
Case "reboot_force"
iCMD = EWX_REBOOT + EWX_FORCE
Case "poweroff"
iCMD = EWX_POWEROFF
Case "poweroff_force"
iCMD = EWX_POWEROFF + EWX_FORCE
Case "hybernate"
On Error Resume Next
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%windir%\System32\rundll32.exe PowrProf.dll,SetSuspendState"
self.Close
exit sub
Case Else ' Default value
iCMD = EWX_POWEROFF
End Select
Next
oOS.Win32shutdown cint(iCmd),cint(0)
End Sub
Hi,
I use this code to shutdown and reboot my PC. However logoff and poweroff will not work on an windows XP. This code came from MS.
Someona has an idee to solve this?
Ths code must be in script
Jan
|
|
|
|
|
I had a problem when you shut-down the PC it did not power off. This was related to the incorrect power management settings in the BIOS.
Would that have anything to do with it?
Cheers,
|
|
|
|
|
I don't think so. My settings are fine and the PC start up fine on the other options
|
|
|
|
|
jan212r wrote: oOS.Win32shutdown cint(iCmd),cint(0)
This line returns a value that you're not picking up. What's the returned value??
|
|
|
|
|
Becourse I don't need that value(normely the pc must close) I did not program it however it gives 6a6 (1702) as error
|
|
|
|
|
First, shouldn't that Win32Shutdown line be above the Next statement it's sitting under??
jan212r wrote: Becourse I don't need that value(normely the pc must close)
Well, obviously you do, because it's returning an error that you can use to try and diagnose this. That error code is that the binding handle is invalid. This leads me to believe that either the account you're running this code under doesn't have sufficient permissions on the remote PC to shut it down (there is a privilege listed in the Win32_OperatingSystem documentation) or there is a problem with the WMI installation on those machines.
|
|
|
|
|
how can i check an 8 bit hexadecimal number in a textbox bit by bit??..txx
hv a nice day!!!
|
|
|
|
|
What do you mean?
Do you mean that if you have FF you want to show this as 11111111 in a text box?
|
|
|
|
|
no..if i enter AAAAAAAA, the output is AAAAAAAA..
but i need to validate first that the input AAAAAAAA is Hexa..so how??
thanks for ur help..
|
|
|
|
|
regex? Or handling keypress for [0-9],[A-F]?
|
|
|
|
|
|
regex? Or handling keypress for [0-9],[A-F]?
can u explain to me in details?
sorry im new VB programmer..
|
|
|
|
|
Check out the keypress event and google for data validation
|
|
|
|
|
Hi There Guys
I was recently given a project/system from a guy working for a particular company.
The system should capture their daily activities, etc. and then give feedback:
e.g. Does the data show a decrease in scrap in the last 6 months, etc.
(if so, allow a graph to be printed that shows this data)
I know about the drawing functions, but so far have only used to make images, etc. for printouts.
I have never created a drawing, graph or anything similar to be displayed on the form itself.
Could anyone please tell me if this is even possible, and perhaps how I might go about achieving this.
Really lost on this one!
Thanks in advance!
See Ya
|
|
|
|
|
|
Hi. I'm trying to send an array of UDT from Excel VBA to a C++ dll but have no idea which direction I should look. Here's what I'm trying to do
MyTestDLL.cpp
#pragma pack(4)
struct MyCppType
{
short iVal;
double dVal;
BSTR bstr;
};
#pragma pack()
void _stdcall MyDllFunction (array of MyCppType)
{
}
MyTestDLL.def
LIBRARY "MyTestDll"
EXPORTS
MyDllFunction @1
MyTestExcel.xlsm
Option Explicit
Declare Sub MyDllFunction Lib "MyTestDLL.dll" (arr() As MyVbaType)
Type MyVbaType
iVal As Integer
dVal As Double
sVal As String
End Type
Sub Test()
Dim arr(2) As MyVbaType
arr(1).iVal = 1
arr(1).dVal = 1.1
arr(1).sVal = "one"
arr(2).iVal = 2
arr(2).dVal = 2.2
arr(2).sVal = "two"
MyDllFunction (arr)
End Sub
|
|
|
|
|
You'd be better off asking this in the Visual C++ forum. It looks like you don't have the declaration in your C++ code correct. But, it's been about 8 years since I done something like this, so I'm not an expert in it.
|
|
|
|
|
Is it possible to do something like this with VBA? None of the sample code I saw tried to pass an array of UDT with variable length string to a C++ dll
|
|
|
|
|
Sure. But, like I said, from what I remember, your problem isn't on the VBA side, it's on the C++ side.
|
|
|
|
|
In my windows application project, with the help of openfiledialog control i choose a other exe file like word.exe, notepad.exe... then how can i get the (dll) reference file and location information for that selected exe file.
For example:
when we add an exe file in a setup project then it will automatically insert all the reference/dependencies file with in it. Like that i need to get all the file and location information.
Thanks in advance
KV
|
|
|
|
|
Not sure, but I am going to guess that you will need to use reflection, although I think this will only work with .NET assemblies.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
It's not listed in a file anywhere. You have to parse the .EXE and examine metadata, export and import tables. It would help greatly if you understood the PE file format. Without that knowledge, you'll find this project impossible.
Google results for PE file format[^].
|
|
|
|
|
Hello All
This is my first time posting so please tell me if it is in the wrong place!
I have visual basic 2008, I made a classroom role with everyone's names in textboxes,
next to the names are 2 checkboxes on each name for here and not here. At the bottom i have
a save button. I would like it so when i click save it saves all the names in the textboxes and
which checkbox is checked to either a text file or excel sheet.
I am not very good with programming but i do know a coupple of things. I would love for anyone
to help me out in putting the code behind the save button.
Code for save button so far:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Thanks Chris
|
|
|
|