|
In What event have you placed that code?
|
|
|
|
|
priya_p233 wrote: dgvTaskList.Rows.Remove(dgvTaskList.Rows(e.RowIndex))
What kind of event argumnent is e?
|
|
|
|
|
I need to logoff a systme by running the script. As per my Knowledge the user32.dll library should be included in the Script and it funciton exitwindow sholud be called with unflag value set to zero.But i saw similar code in Visual Basic code from the site VBnet.com . Please help me out to do same thing with vbscript.
Praveen
|
|
|
|
|
VBScript cannot do this like the code you've seen. It has no facility to make calls into the Win32 API like in your example.
It can, however, use WMI to do the same this using the Win32_OperatingSystem[^] class.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi.
I've created my own print preview using PrintPreview Control . I do have a print dialog being called but now need to know how to allow the printdocument to print Page FROM [] to [] etc. bascially all the options in the PRINT RANGE section of the print dialog etc. i have managed to creat a select case to detect what options are set by user ..but i dont know what comes next to make sure the PRINTPAGE event prints the selected pages , Selection or all etc. at the moment even if i select page FROM & TO its still prints all pages out.
Thankyou.
Robbo
|
|
|
|
|
Private Declare Function SystemParametersInfo _
Lib "user32" Alias "SystemParametersInfoA" _
(ByVal uiAction As Integer, _
ByVal uiParam As Integer, _
ByRef pvParam As String, _
ByVal fWInIni As Integer) As Integer
Private Const SPI_GETSCREENSAVERRUNNING As Integer = &H72
Private Const DESKTOP_READOBJECTS As Integer = &H1
Private Const DESKTOP_CREATEWINDOW As Integer = &H2
Private Const DESKTOP_CREATEMENU As Integer = &H4
Private Const DESKTOP_HOOKCONTROL As Integer = &H8
Private Const DESKTOP_JOURNALRECORD As Integer = &H10
Private Const DESKTOP_JOURNALPLAYBACK As Integer = &H20
Private Const DESKTOP_ENUMERATE As Integer = &H40
Private Const DESKTOP_WRITEOBJECTS As Integer = &H80
Private Const DESKTOP_SWITCHDESKTOP As Integer = &H100
p_lngRtn = SystemParametersInfo(uiAction:=SPI_GETSCREENSAVERRUNNING, _
uiParam:=0&, _
pvParam:=p_lngScreenSaver, _
fWInIni:=0&)
Last 2 weeks back i posted one question, that is "To Determine whether Workstation is locked or not",Mr. Dave gave this code to me.This is perfectly shows the Workstation locked status. I changed Integer instead of Long.
The Above Code is Working fine in VB6.0 and in VB.NET is partially Working, because when the screen saver comes it throws an "Object reference is not set to an instance of an object" error . Plz guide me.
Thanks & Regards
Kumaran
|
|
|
|
|
It doesn't tell you if the workstation is locked. It'll tell you if the screen saver is running though. Those are two very different states. A workstation can be locked, but the screen saver is not running.
You've got the declaration for the function wrong. It should be:
Private Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" _
(ByVal uiAction As Integer, _
ByVal uiParam As Integer, _
ByRef pvParam As Integer, _
ByVal fWInIni As Integer) As Integer
.
.
.
Dim rc As Integer
Dim scrnSaverStatus As Integer
rc = SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, scrnSaverStatus, 0)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi.
where is it best to store temporary variables such as last submitted invoice number which i can read and then increment for next invoice number etc.
is it ok to store in xml or should it be in a Database ???. thanks.
Robbo
|
|
|
|
|
What do you mean by temporary ? If you mean stuff that needs to persist between sessions, I'd use the properties support, or a config file. I'd never use a database.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I tend to use the database since it just prevents so many problems.
|
|
|
|
|
Really ? What problems does it prevent ? You have a table which contains one row, each column representing a temporary variable ? Or, you have a table with 2 columns, and each row stores a name and value ? Or something else ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi guys. thanks for replying.
basically all i want to do is like i said which is store the last submitted invoice NUMBER USED. somewhere which i can read for the next invoice NUMBER and increment it. at the moment i have it working using registry. my app does use xml files for app config settings etc and was looking to do it a better way either by XML or Database. perhaps you can tell me what is best in terms of proper practise for an APP i guess.
Thanks
Robbo
|
|
|
|
|
It depends entirely. If you already have a database, and you don't have any other config file, then I guess you could consider it. But, overall, a database is for storing data. This is not data, it's config information.
If the invoice number is just a number that increments, you could get it from the DB by doing a select MAX(invoicenumber). But, otherwise, a config file or the registry is the way to go IMO
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Chris. Your an abosolute champion.
i think after reading what you said i don't neccessarily need to store such information if i can get my app to read last invnum field in INVOICE table using the select MAX you said right. im guessing i can just add a query in my invoice table to read that right ? is this the way most invoice apps would do it.. your suggestive way i mean.
Robbo
|
|
|
|
|
I can't speak for 'all' apps, but that's how I would do it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Depending on how many clients are storing temporary variables and the type of data it can allow for a little more robust coverage. An area I have experienced some discomfort in is related to Lan or user permissions that hang up using localized storage (assuming you need to use it) using smart clients. If I am looking at less that 50 installations or it is a utility application I like the local storage plan better.
As to the table structure I am evolving if you will. I like the user, key, value and timestamp but I am beginning to move away from it. After a heart to heart with the MS rep the other day I am encouraged with the xml datatype. One of the ideas being the use of an object which composes/decomposes configuration or cache data into an xml datatype then caches it in the appropriate table. I hope to try it out and see how it flys.
|
|
|
|
|
Thankyou Kev for a much informative description of what to consider for the type of enviroment.
I really appreciate you sharing your view , experience and knowledge and importantly time to you took to reply in detail.
Many thanks champ,
|
|
|
|
|
I don't know VB .Net at all and I have a class that I used on online converter to ship to VB. The problem is it's now raising a weird error that I don't understand as I don't know VB .Net at all.
Here is the error:
Error 1 Too few type arguments to 'System.Collections.Generic.List(Of T)'. C:\IRONSPEED4.1.0\BOSTONUNIVERSITY\App_Code\Question.vb 34 12 C:\IRONSPEED4.1.0\BOSTONUNIVERSITY\
At line 34. I can hardly understand VB .Net when I look at it. I
ran this code through a C# to VB .Net converter that has always
done a good job but I'm lost as to what syntax VB expects when it
is attempting to cast an inherits...
using System;
using System.Collections.Generic;
[Serializable ()]
public class Question
{
public String QuestionID;
public String QuestionText;
public Question ()
{
}
public Question (String id, String text)
{
QuestionID = id;
QuestionText = text;
}
}
[Serializable ()]
public class QuestionOption
{
public String OptionID;
public String OptionValue;
public QuestionOption ()
{
}
public QuestionOption (String id, String value)
{
OptionID = id;
OptionValue = value;
}
}
'*****
'***** Here is the first error referenced at Line 34
'*****
[Serializable ()]
public class QuestionList : List<Question>
{
public QuestionList ()
: base ()
{
}
public QuestionList (IEnumerable<Question> collection)
: base (collection)
{
}
public QuestionList (Int32 capacity)
: base (capacity)
{
}
}
[Serializable ()]
public class QuestionOptionList : List<QuestionOption>
{
public QuestionOptionList ()
: base ()
{
}
public QuestionOptionList (IEnumerable<QuestionOption> collection)
: base (collection)
{
}
public QuestionOptionList (Int32 capacity)
: base (capacity)
{
}
}
<div class='ForumSig'></div>
|
|
|
|
|
code-frog wrote: public class QuestionList : List<question>
Why are you doing this at all ? Why not just define an alias, if you must ?
Anyhow, I think it's List(Of Question) that you need.
But, I hate VB as well, I'm taking a stab at it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I'll try that. GAWD that is horrible syntax. Who in the hell could work in that? What was wrong with the C++ syntax? It was clear, concise and easy to understand...
|
|
|
|
|
There's a great divide here. Some people think that concise syntax is easy to understand, others want a more English like syntax, so it's more 'natural'. One problem with this: I can't work out how to set a variable in the debugger in VB. myVal = 0 evaluates to an equality check, not an assignment operation.
Another is, VB makes no sense. Using () all the time means that it's hard to work out what's going on.
Dim i as int = Someting(i)
Does that look into an array, or does it call a method and assign the return value ? I don't know.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Yeah, I know... Ever since VB programming has gone straight to hell. I don't mean to slam VB but gosh this is a huge problem. It would be one thing if you could put VB in with C# and just run them side by side in the same project. That would be so nice...
Now watch I'm missing something stupid like using VB or some other equal dumb statement...
|
|
|
|
|
You can put your VB.NET code in a dll and use it from C#.
If you have a using Microsoft.VisualBasic statement anywhere, delete it and fix the code, that's the way they import all the old VB6 hacks.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
(via Instant VB)
Imports System
Imports System.Collections.Generic
<serializable ()=""> _
Public Class Question
Public QuestionID As String
Public QuestionText As String
Public Sub New()
End Sub
Public Sub New(ByVal id As String, ByVal text As String)
QuestionID = id
QuestionText = text
End Sub
End Class
<serializable ()=""> _
Public Class QuestionOption
Public OptionID As String
Public OptionValue As String
Public Sub New()
End Sub
Public Sub New(ByVal id As String, ByVal value As String)
OptionID = id
OptionValue = value
End Sub
End Class
<serializable ()=""> _
Public Class QuestionList
Inherits List(Of Question)
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal collection As IEnumerable(Of Question))
MyBase.New(collection)
End Sub
Public Sub New(ByVal capacity As Int32)
MyBase.New(capacity)
End Sub
End Class
<serializable ()=""> _
Public Class QuestionOptionList
Inherits List(Of QuestionOption)
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal collection As IEnumerable(Of QuestionOption))
MyBase.New(collection)
End Sub
Public Sub New(ByVal capacity As Int32)
MyBase.New(capacity)
End Sub
End Class
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter
|
|
|
|
|
So are you the author of Instant VB? If so that's cool! You might just have won a customer.
|
|
|
|