|
It's the same as zipping a file. You just have to zip one file at a time into the same archive.
|
|
|
|
|
So, I just create a zip file called zip.zip, and just keep calling that same file in my zip function until I finish all of my files?
|
|
|
|
|
It depends on the library you're using, but yes, add one file at a time to the same .ZIP file.
|
|
|
|
|
I have an item called DashboardItem with inherits Windows.Forms.UserControl and declared the class as MustInhert :-
Public MustInherit Class DashBoardItem<br />
Inherits Windows.Forms.UserControl
I have then added some common features, such as a close button and title label.
The next step is to inherit DashboardItem into another class :-
Public Class VehicleTracking<br />
Inherits PDM.Session.DashBoardItem
The problem I have now is the designer reports :-
The designer must create an instance of type 'PDM.Session.DashBoardItem' but it cannot because the type is declared as abstract.
I need guidance on what to do to resolve this issue.
I checked out the MSDN Online help which was not very helpful at all, check out the description of the error message: http://msdn2.microsoft.com/en-gb/library/aa289354(VS.71).aspx[^]
Any help is appreciated
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
It doesn't work because Visual Studio can't create an instance of ab abstract type anymore than your code can. For example, when you design a new form, Visual Studio creates an instance of System.Windows.Forms.Form and lets you drop controls on it, right?
Why is it creating an instance of Form instead of your class called Form1?? Because Form1 isn't compiled and doesn't yet exist. The Designer always creates an instance of the base class of the type you want to design. So, in your case, when you try to design a new control based on DashBoardItem, the Designer tries to create an instance of DashBoardItem and can't, because it's MustInherit (abstract).
Read more on why it doesn't work here[^]. There's a followup post on a possible work around here[^]. Just a warning, it's a bunch of work on your part to put this workaround in place. It's even more of a pain to get it to actually work.
|
|
|
|
|
I found the solution, although I do not think it's right. If I remove the MustInherit clause the the DashboardItem class, it works fine
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Yep, but then it's no longer an abstract class. If this is acceptable in your design, great, if not, well....
|
|
|
|
|
Hi All,
In my application, i am using vb 6.0 as front end and MS-SQL Server 2005 Express Edition as Back End.
SQL Server 2005 is installed in another system called Sys2.
I am using the following connection string in Visual Basic, to connect to SQL Server.
Conn.ConnectionString = "Driver={SQL Native Client};Server=Sys2\SQLEXPRESS;Database=OT_LOG;Trusted_Connection=yes;"
But when I try to run the application, its giving the following error:
[Microsoft][SQL Native Client][SQL Server]Login failed for user". The user is not associated with a trusted SQL Server connection.
Please help me in this issue.
Thanks in Advance,
Regards,
|
|
|
|
|
|
|
If you are using a trusted connection, then your account must be defined on the remote node (Sys2 in your case).
A probable better solution is to use a defined account and password;
for example:
Driver={SQL Native Client};Server=Sys\SQLEXPRESS;Database=OT_LOG;uid=OT_Log_User;pwd=OT_Log_User_PWD
The username and password can be stored in the registry, a config file, and INI file, etc.
Hope that helps.
Tim
|
|
|
|
|
Hi Tim,
Thanks lot for your help.
Can you give me some idea about that username and password.
Is that username and password same as windows username and password or we need to create specific for this. If so, how to do with that.
Regards,
|
|
|
|
|
The username and password can be whatever you want; there are defined on the SQLServer end. Create a user account, define the password, and grant access to the database.
|
|
|
|
|
Hi,
I am dealing with one windows application. In this application I m using DataGridView control. I have used multi threading on this control to display updated data continuously. But When second thread displays the data both scroll positions reset to original state. I want retain scrollbar positions. I request you to plz guide me for the same
Thanx
Gurudatta B. Shelke
|
|
|
|
|
There's no managed code way to do this. You've have to use the Win32 api to do it. The DataGridView is a bit problematic in this. You can find out more about it here.[^]
|
|
|
|
|
Hello all,
I need to take in today's date in parts (using datetime.now.day etc.) and output them. The problem is that if the date is less than ten it is shown as "9" instead of "09". Same with the time.
Is there an easy way to show it in the format i want or do i have to get each ones length and check if it needs adding to?
Any help will be appreciated.
|
|
|
|
|
Use Format Function
Ex : format(now.day ,"00")
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
.... or now.Days.ToString("D2")
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
small correction
instead of "Days" put "Day"
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Use a format string to get the parts of the date formatted the way that you want.
Examples:
Dim fullDate = theDate.ToString("yyyy-MM-dd")
Dim year = theDate.ToString("yyyy")
Dim month = theDate.ToString("MM")
Dim day = theDate.ToString("dd")
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks to everyone for the quick reply!
|
|
|
|
|
You can use the following function:
#Region "Function GetDate - returns date / time according to format"
Public Function GetDate(ByVal MyFormat As String, Optional ByVal dt As Date = Nothing) As String
Try
If dt = Nothing Then
Return Now.ToString(MyFormat, DateTimeFormatInfo.InvariantInfo)
Else
Return dt.ToString(MyFormat, DateTimeFormatInfo.InvariantInfo)
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "GetDate", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Return ""
' MyFormat can be
' * d :08/17/2000
' * D :Thursday, August 17, 2000
' * f :Thursday, August 17, 2000 16:32
' * F :Thursday, August 17, 2000 16:32:32
' * g :08/17/2000 16:32
' * G :08/17/2000 16:32:32
' * m :August 17
' * r :Thu, 17 Aug 2000 23:32:32 GMT
' * s :2000-08-17T16:32:32
' * t :16:32
' * T :16:32:32
' * u :2000-08-17 23:32:32Z
' * U :Thursday, August 17, 2000 23:32:32
' * y :August, 2000
' * dddd, MMMM dd yyyy :Thursday, August 17 2000
' * ddd, MMM d "'"yy :Thu, Aug 17 '00
' * dddd, MMMM dd :Thursday, August 17
' * M/yy :8/00
' * dd-MM-yy :17-08-00
' *dd/MM/yyyy : 17/08/2000
End Function
#End Region
Comment:
You can improve and add another overloaded function that will get as parameter an enum parameter (containing the different formats)
Shay Noy
|
|
|
|
|
Thanks again but i got it working using the following code to timestamp a file that I have processed:
File.Move(fileToMove, ConfigurationManager.AppSettings("NewPath").ToString() _
& Path.GetFileNameWithoutExtension(fileToMove) _
& " " & System.DateTime.Now.Day.ToString("D2") _
& System.DateTime.Now.Month.ToString("D2") _
& System.DateTime.Now.Year.ToString("D4") _
& "_" & System.DateTime.Now.Hour.ToString("D2") _
& System.DateTime.Now.Minute.ToString("D2") _
& System.DateTime.Now.Second.ToString("D2") _
& System.DateTime.Now.Millisecond.ToString("D3") _
& Path.GetExtension(fileToMove).ToString())
|
|
|
|
|
Hi,
this is not OK, you should call DateTime.Now only once, store it in a variable,
and use it over and over; the way you do it, you may get inconsistent information
(imagine what happens when the time goes from 01:59:59 to 02:00:00 WHILE executing
your very long statement!).
Furthermore, you could do it with the DateTime.ToString() method itself, as Guffa already
told you. That one even accepts some unrecognized characters in its format specifier,
so you could try DateTime.Now.ToString("yyyMMdd_HHmmssfff")
Note that I have put the year first, so alphabetical and chronological order is the same thing.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
One more remark,
if the file generation code is in a loop, you may end up with duplicate filenames:
the milliseconds in DateTime.Now don't increment by one; they typically
get increased by 10, 16, or even 55 depending on your hardware and operating system.
If you want to know more about this, you may want to read my timers article.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|