|
Well, the short answer is
form2.Show()
Me.Close() However, in reality it's not quite that simple. When you show your first form with Application.Run(New Form1()) , the lifetime of the application is tied to the lifetime of your form. There's an article[^] by Marc Clifton on this site that explains how to switch top-level forms using a custom application context.
Another approach is to start the application with an object that knows how to launch and close the forms in your application. To start with, it would show the initial "view" of your application (Form1) and, upon request, switch to a different "view", which could be closing form1 and opening form2 or opening forms 2 or three and closing form1 conditionally or whatever.
The second approach is infinitely more flexible, but it also requires more work to implement.
Charlie
if(!curlies){ return; }
|
|
|
|
|
in the Form1 , write this, attached to the Command1 button :
Sub Command1_Click()
Form2.Show
End Sub
in the Form2, write this :
Private Sub Form_Load()
Unload Form1
End Sub
aprx
|
|
|
|
|
Hi.
Is it possible to convert a bitmap held in memory to jpg, also held in memory?
|
|
|
|
|
Hi,
I assume ur bitmap is in form of array of bytes in that case u can convert it to jpg using...............
Dim wstWriter1 As New FileStream("c:\abc.jpg", FileMode.Create)
Dim bwWriter As New BinaryWriter(wstWriter1)
bwWriter.Write(pi_arrbyteFiles)
bw.close()
wstWriter1.close()
I hope this is what u want......................:->
regards,
Ritesh
|
|
|
|
|
Well not exactly….
I have bitmap in memory (byte array)
Now… I want to convert the bytes (the bitmap) to a jpg picture, without saving it to disk first.
Like using a codec
|
|
|
|
|
Hi (sorry for my english) - VB6 and W2K
I need a script for download CGI generated page to file. Actually using script from http://www.devx.com/vb2themax/Tip/19203 , but its unstable (returning err "-2147220504" and description "An error occurred calling InternetOpenUrl function"). Please recommend me a solution of this error or better script.
THX
|
|
|
|
|
Hello there
I have created one windows application which works like windows explorer. while browsing the folders in application when user opens any file like any text file . I create one thread for that(can open more then one file at the same time so cannot define the list of threads ). and when user close the application , the application do not stop due to the running thread(s) I kept a global array of threads but from there I can do every thing except stopping the thread.
Global array ::::: because user can open more then one files togather or one by one.
Can any one help me in this issue ????? to get the list of threads on one particular form and ability to close them or break them (so that user can keep working on text file even the application is closed)
The Code is
'Form Level Declaration
Dim th() As Thread
' Event Level... where Thread is created
Dim t As New Thread(AddressOf DisplayFile)
t.Start()
th(th.Length - 1) = t
ReDim Preserve th(th.Length + 1)
' On form Closing event
Dim count As Integer
For count = 0 To th.Length - 1
If Not th(count) Is Nothing Then
If th(count).ThreadState = ThreadState.Running Then
th(count).Abort()
th(count) = Nothing
End If
End If
Next
Rizwan Bashir
|
|
|
|
|
I think you should have done it like this:
' Event Level... where Thread is created
Dim t As New Thread(AddressOf DisplayFile)
t.Start()
ReDim Preserve th(th.Length + 1)
th(th.Length) = t
|
|
|
|
|
yes you are right.... I might miss typed here....
any ways with this change I am waiting for reposnse.
thanks
Rizwan Bashir
|
|
|
|
|
You threads should terminate themselves and should not be aborted from somewhere else. The most simplest way to do that would be to define a shared bool property somewhere in your app. Your threads would have to recheck the property in given intervals and if set to true terminate themselves.
If you dont like the idea of a shared property then you will have to encapsulate each thread in a class where you can define and switch the bool property.
|
|
|
|
|
The Problem I just realized is that I am calling the text files to open through Shell where I passed the parameter to wait
Shell(ExecutablePath & " " & Chr(34) & FileName & Chr(34), AppWinStyle.NormalFocus, True)
the last true is to wait until it completes .. so the thread is not breaking as it is in the waiting state. any comments to break the thread this way.
*** I am waiting in shell command becauseI have to do some operations if he changes some thing.
IS there still any solution ????
Rizwan
|
|
|
|
|
please send me answer how to connect oracle and vb.net
how to navigate dat
san
|
|
|
|
|
If all you want are articles and code samples, try searching for them yourself. Behold the power of Google[^]!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello...how to disable the textbox using the datarow???
is it true if i write it like this
datarow("column_name")= text.readonly
or anyone can give me any suggesstion....please....
besah
|
|
|
|
|
Hi,
I don't know what u exactly want ..........but if ur Datatable has bit column than u can bind the TextBox's Readonly property with that bit column which will make ur TextBox Readonly based on the Value of Current Bit column........
Regards,
Ritesh
|
|
|
|
|
Could somebody help me to format a field in crystal report.
I have a field named "Code" with value is 9393. However, I want to add 0000 in front of it, then it would become: 00009393. I know that in crystal report that have a string function called length and ReplicateString, so that we can use to add 0000 in front of a number. I know the way to do it, but I don't know how to write it in "Format Formula Editor". Could anyone help me on this? thanks.
John
|
|
|
|
|
if u are using Crystal Rerpots 9.0 then click on view menu select field explorer. from field explorer right click on formula fields and select new.
enter the name of the formula. then a new window will appear. in the editor just write
"0000" & Code
it will do the required thing save it and close it drag the field from the formula fields to the report.
hopefully it will help
computer... Programming... whats that
|
|
|
|
|
Thank you. It really helps.
|
|
|
|
|
How is this coded in visual basic 6? I have gotten everything but this.
copy coversheet1 from test.xls in c:\test directory
paste or create coversheet1 to test2.xls in c:\test2 directory
both excel documents exist but I need to transfer a sheet from one document to the other.
Any help would be greatly appreciated.
Thanks
Beginner in VB.Net
|
|
|
|
|
Actually, your question has nothing to do with VB. Rather, it's a question of knowing Excel object model, which I'm not that great with.
After a cursory search through MSDN, I couldn't find a Copy method in the Worksheet object documentation.
In theory, you'll have to open both workbooks in your Excel object (I'm not even sure this is possible!) Call some kind of copy method on the Worksheet object you're copying from and give it the workbook name to copy the sheet to. You'll probably also have to give it the name of a worksheet in your destination workbook so the Copy method knows where to put the copy in the worksheet order.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
This is what i got form MSDN ....................
You can add one or more worksheets to the Worksheets collection by using the collection's Add method. The Add method returns the new Worksheet object. If you add multiple worksheets, the Add method returns the last worksheet added to the Worksheets collection. If the Before or After arguments of the Add method are omitted, the new worksheet is added before the currently active worksheet. The following example adds a new worksheet before the active worksheet in the current collection of worksheets:
Dim wksNewSheet As Excel.Worksheet
Set wksNewSheet = Worksheets.Add
With wksNewSheet
' Work with properties and methods of the
' new worksheet here.
End With
You use the Worksheet object's Delete method to delete a worksheet from the Worksheets collection. When you try to programmatically delete a worksheet, Microsoft® Excel will display a message (alert); to suppress the message, you must set the Application object's DisplayAlerts property to False, as illustrated in the following example:
Function DeleteWorksheet(strSheetName As String) As Boolean
On Error Resume Next
Application.DisplayAlerts = False
ActiveWorkbook.Worksheets(strSheetName).Delete
Application.DisplayAlerts = True
' Return True if no error occurred;
' otherwise return False.
DeleteWorksheet = Not CBool(Err.Number)
End Function
Note When you set the DisplayAlerts property to False, always set it back to True before your procedure has finished executing, as shown in the preceding example.
You can copy a worksheet by using the Worksheet object's Copy method. To copy a worksheet to the same workbook as the source worksheet, you must specify either the Before or After argument of the Copy method. You move a worksheet by using the Worksheet object's Move method. For example:
Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")
Worksheets("Sheet1").Move After:=Worksheets("Sheet3")
The next example illustrates how to move a worksheet so that it is the last worksheet in a workbook:
Worksheets("Sheet1").Move After:=Worksheets(Worksheets.Count)
I hope this will help u................:->
Regards,
Ritesh
|
|
|
|
|
Ritesh1234 wrote:
You can copy a worksheet by using the Worksheet object's Copy method. To copy a worksheet to the same workbook as the source worksheet, you must specify either the Before or After argument of the Copy method.
I am trying to copy a worksheet from one workbook to another workbook. From what I get from you is, copying a worksheet in the same workbook and not to a totally different workbook.
I was able to add a sheet to the workbook but that doesn't solve the problem of copying the data over to it.
This is my task. I am creating an excel document in Visual Basic code with 6 worksheets. Now I need to be able to create another sheet making it the cover sheet for that work book. I have another excel file that acts like a template as to what the cover sheet should look like. I need to copy that worksheet containing the cover sheet to the new file I created in visual basic. EX:
Test.xls contains coverSheet
Test2.xls contains 6 worksheets
I need to take the coverSheet from test.xls and put that worksheet into test2.xls
Is it possible to copy from one workbook to another different workbook?
Thanks for the help
Beginner in VB.Net
|
|
|
|
|
hi,
Did u tried with worksheet.Add method????
|
|
|
|
|
Hi Ppl,
I would like to populate my datagrid with just the months in vertical order with the datasource from a dataset.
From my dataset I can get 2 col namely QtyOrdered and QtyTaken
But I would like to display these for 12 month period as shown below
Month QtyOrdered QtyTaken Difference
Jan 10 20 +10
Feb 20 10 -10
Mar 30 10 -20
...
...
Dec 50 20 -30
Can I do this in my SQL statement or do I have to do this at grid popluation?
Tnx
|
|
|
|
|
I'm a relatively new programmer so I hope that I can explain this well.
I use the following variable assignment to pass through a sql string:
FormatDate = Format(#12/31/2003#, "dd-MMM-yyyy")
This works for me, but when I replace the hardcoded date with a variable that is assigned to a text box (for user input), I get an error msg (ORA-01847).
FormatDate = Format(Session("1"), "dd-MMM-yyyy")
Any thoughts?
Thanks in advance.
|
|
|
|