|
Hello,
I have Form1 wich loads at startup. When i press one button on this Form1, it launches Form2.
The problem occurs in when i try to exit. It will bring up a MessageBox for to ask you if i want to Exit Form2. If I press No, Form1 comes in front of Form2. Is there a way to make sure that Form2 stays upside.
Details. Form2 TopMost must stay False. Because the problem i have when it is enabled is that Form1 is activated while Form2 is in front.
Can someone help me with this.
Thanks
<br />
Private Sub Form_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing<br />
If OK2Close = False Then<br />
If MessageBox.Show("Are you sure you want exit?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification) = DialogResult.No Then<br />
e.Cancel = True<br />
<br />
End If<br />
End If<br />
End Sub<br />
|
|
|
|
|
When a form calls MessageBox, the message box is shown Modally to the caller form.
It means that, until the message box hasn't moved away, you cannot access the caller form. One other thing that a modal form (here the MessageBox) does, is that it sets the focus to it's caller form, say the Parent Window.
If you call MessageBox from Form1, it will set the focus on Form1.
But to handle your problem, I suggest:
Make a Public Function in Form2 that shows the message box and returns either True if Ok was pressed or False if Cancel is pressed.
Now in the Form_Closing event of form1, instead of calling the message box, call the function in Form2 and simply check the return value!
I think this is going to solve your problem.
|
|
|
|
|
Can we change the background color of the listview such that we can have row 1 which can have background color as red and row2 should have background color as blue ?
Thanks
|
|
|
|
|
Try the following ,
when you are adding a item to your list view check for alternate row to apply different color.
Say if current row is odd row then write
ListView1.Items(itemindex).BackColor = (New System.Drawing.Color).Aquamarine<br />
and if it is even then
ListView1.Items(itemindex).BackColor = (New System.Drawing.Color).Bisque
Please note that this code colors background of all columns but if the last column width dosen't fills the list view then the list view background appears. So make sure that you columns fits the listview width.
Kumar Saurabh
|
|
|
|
|
Kumar saurabh wrote:
Say if current row is odd row then write
ListView1.Items(itemindex).BackColor = (New System.Drawing.Color).Aquamarine
and if it is even then
ListView1.Items(itemindex).BackColor = (New System.Drawing.Color).Bisque
How do you determine which row is ODD or EVEN?
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
I never coding in for this purpose, but I just have some concept from other developer on the internet. Example that you loop to call record from the database and display on the list view.
1. Loop one by one of your record to and put it in the listview row by row.
2. May be use MOD function to check for a remain value of listview index number. (if 2/2 remain 0, if 3/2 remain 1).
3. Base on the remain (only 1 and 0) they can set the background of each row in the listview at the time of loop process.
Try to use google to search for this case and wish you good luck.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
THe function is written in VC++ and created as Maindll.dll.
The functions in maindll.dll is as follows.
we have write code in vb to call these functions and display its value.
Please help me.if poosible send me code to my mail.nayaz600@yahoo.com
BOOL MF_GetMsg( MF_MAIL *mf_mail)
int MF_SendMsg( MF_MAIL *);
BOOL MF_RemoveMsg( MF_MAIL *);
int MF_NumItem( void );
void SMTPServerName(CString serverName);
typedef struct MF_MAIL {
TCHAR env_file[MAX_PATH];
TCHAR body_file[MAX_PATH];
} MF_MAIL;
|
|
|
|
|
Hi all,
I have a tree view where i show different files present in a system. I have to display icon of corresponding file type when i'm adding a file to the tree. One way to do it to add the icons in image list and the check for the extension and show corresponding icon. But in this case it's very much possible taht I leave many icons associated with file extensions.
I want to know the registered icon of a corresponding file type at run time. How can I do that.
Thanks in advance.
Kumar Saurabh
|
|
|
|
|
How to use the SHGetFileInfo function to get the icons that are associated with files in Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;319340
|
|
|
|
|
I wanty to make an WINDOW SERVICE that could download and upload data to an ftp site at a specific time.
KnowME
|
|
|
|
|
How to access a File Transfer Protocol site by using Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;832679
How To Create a Setup Project for a Windows Service in Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;317421
|
|
|
|
|
I want to transfer data between two sql server.For that I have to use DTP Programming in vb.net. So plz give me an example(Code) of this problem so that I can easily solve this problem
Thanks
pkc
|
|
|
|
|
DTS copy database, about half way down the page.
SQL Server 2000 provides programming samples
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/samples/samples_2o1f.asp
|
|
|
|
|
I am designing report with crystal report using Report creation API
functions.Please help me solve a problem: How do i set a condition formula
for report objects such as TextObject,FieldObject,...at runtime using Report creation API functions?
Thanks.
|
|
|
|
|
im a bit confused on this
im using the socket class in a console app
here is my server layout
1. set socket to listen for connections
2. loop
3. acceptsocket
4. heres where im having problems i wana pass that socket off so the loop will continue to accept new connections, Im also unsure about how to name each new connection so i can send data to it later
any help would be great
thanks
|
|
|
|
|
The Ultimate Socket Library
http://www.codeproject.com/vb/net/Silence_Socket.asp
By The Silence
Multi-threaded .NET TCP Server Examples
By Yuen Chiu So
http://www.codeproject.com/dotnet/dotnettcp.asp
|
|
|
|
|
Hello,
I am making help for "URDU" LANGUAGE not for English language. I am using HTML HELP WORKSHOP (comes with VS.NET)".
It works well, but it does not allow me to write text in "URDU" language when i want to add any entry in contents windows.
How can i do this.
reply me
EsHbAn BaHaDuR
|
|
|
|
|
hi!
im very new to vb.net and am currently taking a class on it. i looked around and found an article "Simple VB.NET MIDI & Wave Play Class" that would work for my purposes. i want to add a sound event to a button click. i dont understand the part about "Make a reference to DirectX7 COM-Object"
what does that mean? i have a good idea- reference to a dll maybe?- what do i type to reference it with directx 9.0?
thanx for any input!
|
|
|
|
|
Forget using DirectX. It's massive overkill for what you're describing. I think your looking for a much simpler example, such as Code: Playing a Sound (Visual Basic .NET)[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks Dave Kreskowiak for the speedy reply! everything looked simple enough with good instructions... but, i added the code and only had one section which shows an error:
Private Sub Button1_Click(ByVal sender As System.Object, _<br />
ByVal e As System.EventArgs) Handles Button1.Click
my button is named btnConvert, i changed that...it says statment is not valid in a name space. does it need to be moved? where to? i just cut and pasted as it appeared in a new class page.
thanx for your help again!
if im a little too inexperienced and just need to read more please feel free to flame; flaming builds good charactar.
|
|
|
|
|
You can't just cut and paste the code and expect it to work. You must understand what's going on in the code and why in order to get it to work with your code. In this case, start a new Windows Forms project and add a button to the form (don't rename it.)
Then copy and paste the button-click code from the example into the code of the form. Then copy and paste then SoundClass code and paste it in above the Form1 class code. You should end up with (2) classes, layed out something like this:
Public Class SoundClass
.
. yada yada yada
.
End Class
Public Class Form1
.
. yada yada yada
.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim SoundInst As New SoundClass()
SoundInst.PlaySoundFile("C:\ringout.wav")
End Sub
End Class
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am working on integrating a VB.NET application with RightFax. We
are actually converting a program written in Cincom SmallTalk to
VB.NET and we are experiencing some problems with faxing. In the
SmallTalk version of our application we used RightFax's embedded
codes to fax. We just printed the print job to the RightFax printer
and included the embedded codes in the print job. The embedded
codes are what tells RightFax where to fax to.
The problem is that VB.NET does not allow you to print in a Native
Font (such as Courier). I believe this is because the GDI+ only
recognizes true type fonts. Is there anyway to print in Courier in
VB.NET?
|
|
|
|
|
spinski wrote:
The problem is that VB.NET does not allow you to print in a Native
Font (such as Courier).
Yes, it does. But I don't think that's what your asking.
Are you asking how to print raw data, just like printing to an old dot matrix printer from a DOS app?
HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the reply. I am looking into the printing Raw data article. I am not sure if this is what I need to do or not. I just know that RightFax requires a font such as Courier (not Courier New) to print the embedded codes.
Also, you mentioned that you can use the Courier font to print in VB.NET. How?
|
|
|
|
|
Are you talking about printing using the RASTER Courier font? I was talking about the TrueType fonts or printing Raw data the device font. Raster fonts are no longer supported by VB.NET, or anyother lanugage targeting the .NET Framework.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|