473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to create popup window at run time?

Hi All,

I am new to vb.net, Can anybody tell how to create a pop up window at runtime. If I have more than 100 product names in the database, While I click the letter 'A' in text box, the window should be open and all the product names starts with letter 'A' should listed in the window in ascending order. (similarly A to Z)
Jul 2 '07 #1
5 2065
Vidhura
99
Hi All,

I am new to vb.net, Can anybody tell how to create a pop up window at runtime. If I have more than 100 product names in the database, While I click the letter 'A' in text box, the window should be open and all the product names starts with letter 'A' should listed in the window in ascending order. (similarly A to Z)
Create form instance and show

Dim frm as Form
frm=new form()
frm.show()
Jul 2 '07 #2
Create form instance and show

Dim frm as Form
frm=new form()
frm.show()
Hi Vidhura,
Above codes are to show one form to another, like link. But I am asking the main form should not hide or close. The window should be opened. (For example you might have seen this in medical shop or library in search of item name or books)
Jul 2 '07 #3
Vidhura
99
Hi Vidhura,
Above codes are to show one form to another, like link. But I am asking the main form should not hide or close. The window should be opened. (For example you might have seen this in medical shop or library in search of item name or books)
The main form will not be hide or close if you open another form,unless otherwise you specify mainform.hide or mainform.close
you can design the form as like popup window and can show the values.
Jul 2 '07 #4
The main form will not be hide or close if you open another form,unless otherwise you specify mainform.hide or mainform.close
you can design the form as like popup window and can show the values.
Is it possible to design form as popup window? How?? That's the thing I'm asking.
Jul 2 '07 #5
Vidhura
99
Is it possible to design form as popup window? How?? That's the thing I'm asking.
1.Open new window form.Set the controlbox property to false.Resize the window form as per your requirment.

2.Add label to show the names or texts.Set the Autosize to true

3.Add button control.Add this.close in button click event

Here i m giving sample code

This is the form designer for popup window

Expand|Select|Wrap|Line Numbers
  1. namespace TestCombo
  2. {
  3.    partial class Form1
  4.    {
  5.       /// <summary>
  6.       /// Required designer variable.
  7.       /// </summary>
  8.       private System.ComponentModel.IContainer components = null;
  9.  
  10.       /// <summary>
  11.       /// Clean up any resources being used.
  12.       /// </summary>
  13.       /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  14.       protected override void Dispose(bool disposing)
  15.       {
  16.          if (disposing && (components != null))
  17.          {
  18.             components.Dispose();
  19.          }
  20.          base.Dispose(disposing);
  21.       }
  22.  
  23.       #region Windows Form Designer generated code
  24.  
  25.       /// <summary>
  26.       /// Required method for Designer support - do not modify
  27.       /// the contents of this method with the code editor.
  28.       /// </summary>
  29.       private void InitializeComponent()
  30.       {
  31.          this.btnOK = new System.Windows.Forms.Button();
  32.          this.label1 = new System.Windows.Forms.Label();
  33.          this.SuspendLayout();
  34.          // 
  35.          // btnOK
  36.          // 
  37.          this.btnOK.Location = new System.Drawing.Point(108, 203);
  38.          this.btnOK.Name = "btnOK";
  39.          this.btnOK.Size = new System.Drawing.Size(75, 23);
  40.          this.btnOK.TabIndex = 0;
  41.          this.btnOK.Text = "OK";
  42.          this.btnOK.UseVisualStyleBackColor = true;
  43.          this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
  44.          // 
  45.          // label1
  46.          // 
  47.          this.label1.AutoSize = true;
  48.          this.label1.Location = new System.Drawing.Point(105, 74);
  49.          this.label1.Name = "label1";
  50.          this.label1.Size = new System.Drawing.Size(0, 13);
  51.          this.label1.TabIndex = 1;
  52.          // 
  53.          // Form1
  54.          // 
  55.          this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  56.          this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  57.          this.ClientSize = new System.Drawing.Size(261, 266);
  58.          this.ControlBox = false;
  59.          this.Controls.Add(this.label1);
  60.          this.Controls.Add(this.btnOK);
  61.          this.Name = "Form1";
  62.          this.Text = "Form1";
  63.          this.Load += new System.EventHandler(this.Form1_Load);
  64.          this.ResumeLayout(false);
  65.          this.PerformLayout();
  66.  
  67.       }
  68.  
  69.       #endregion
  70.  
  71.       private System.Windows.Forms.Button btnOK;
  72.       private System.Windows.Forms.Label label1;
  73.    }
  74. }
  75.  
This .cs file to write ur methods and events

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8.  
  9. namespace TestCombo
  10. {
  11.    public partial class Form1 : Form
  12.    {
  13.       string result;
  14.       public Form1(string str)
  15.       {
  16.          result = str;
  17.          InitializeComponent();
  18.       }
  19.  
  20.       private void btnOK_Click(object sender, EventArgs e)
  21.       {
  22.          this.Close();
  23.       }
  24.  
  25.       private void Form1_Load(object sender, EventArgs e)
  26.       {
  27.          this.label1.Text = result;
  28.       }
  29.    }
  30. }
  31.  
  32.  

The following is the sample code to call this popup window

Expand|Select|Wrap|Line Numbers
  1.  private void button1_Click(object sender, EventArgs e)
  2.       {
  3.          Form1 frm = new Form1("Hi this is");
  4.          frm.Show();
  5.  
  6.       }
  7.  
Jul 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Applebrownbetty | last post by:
Hi, I'd like to append/amend the following code from the Dreamweaver extension "Open Picture Window Fever" for the ability to center the PopUp window: By default, it allows the window to be...
7
by: E Michael Brandt | last post by:
I have been lurking here for some time, and now would like to ask a question of you clever coders: My JustSo PictureWindow 3 Extension for Dreamweaver has stumbled in the face of the new Opera...
19
by: Davey | last post by:
I have a popup window that opens using the following function. Unfortunately when this function (or any other popup generating function) is called from *within* a popup, it opens it within the...
3
by: ypress | last post by:
Hi. I have a page that contains this simple function: <script language="javascript"> function openPop(url, name, w, h) { var features = ""; features += "scrollbars=no,"; features +=...
0
by: ChrisB | last post by:
I'm attempting to open a new window from a LinkButton in a DataGrid. I can set a session variable in the ItemCommand event for the LinkButton like so: // this is used to handle the ItemCommand...
2
by: Novice | last post by:
Hi all, as you can see from the subject, I'm try to use an asp:button to create a new browser window and output contents to new window But default if I do the Response.Write("..." The output...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
1
by: Jennyfer J Barco | last post by:
Hello I have a datagrid and a linkbuttom in the datagrid that says Picture, every time I click on the link "Picture" my program opens a popup window showing a picture of the item the selected and...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
11
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.