当我在combobx中选择一个项目时,其子项目应出现在下一个组合框中 [英] When i select an item in a combobx its subitem should come in next combobox

查看:39
本文介绍了当我在combobx中选择一个项目时,其子项目应出现在下一个组合框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在combobox1中选择一个项目时,假定笔
那么它的子项应该出现在combox2中,例如parker,lexi等..

我如何在Visual Studio 2005中做到这一点...我使用vb ..



When i select an item in combobox1 suppose pen
then its subitems should come in combox2 say parker, lexi etc. ..

how do i do this in visual studio 2005 ... i use vb ..



Thnx ..very much for the help ...
but my dobut still exits ..this talks about creating a new web site ... and all ...
what i want is ..i just want to implement this in a form of my program ...
that is Ther is a combobox named Items and ..its sub combobox products ..
so ..when i selct an item from Items its sub products should come in sub combo box .. how will i do it from ..database ...
plz help ..









Hook the ComboBox.SelectedValueChanged event, and update the second ComboBox based on that value.
Can you please tell me how i will ..do this ..with some eg:.. im a new bie ...




我不接受它对您正在做的无礼帮助..您能告诉我我可以参考哪些文本吗?以及如果您知道它们的页码...我尝试了很多..但没有发现...非常有用...




i dont ..take it rude its a great help that you are doing to me .. can you please tell me which text i can refer ..and page number if u know them ... i tried a lot ..but did not find ...much useful ...

推荐答案

Hmm ...我很好奇如何用ASP答案解决VB.Net问题.

如果是ASP,则应采用这种方式进行标记.否则,ASP控件将无法在WinForms应用程序中运行.

这个想法与级联下拉菜单相同,但是如果它是WinForms应用程序,则必须自己实现.

挂钩ComboBox.SelectedIndexChanged事件,并根据该值更新第二个ComboBox.


[关于此的其他问题]

抱歉,但不要粗鲁,但是如果您不理解钩住ComboBox.SelectedIndexChanged事件,并根据该值更新第二个ComboBox".然后,你需要买一些书.

在您的代码中,挂钩和代码类似于:
Hmm...I''m curious how a VB.Net question was solved with an ASP answer.

If this is ASP, it should have been marked that way. Otherwise, an ASP control will not work in a WinForms app.

The idea is the same as the cascading drop down, but you''ll have to implement it yourself if it''s a WinForms app.

Hook the ComboBox.SelectedIndexChanged event, and update the second ComboBox based on that value.


[To your other question about this]

Sorry, but not to be rude, but if you don''t understand "Hook the ComboBox.SelectedIndexChanged event, and update the second ComboBox based on that value." then, you need to buy some books.

Within your code, the hook and code looks something like:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles ComboBox1.SelectedIndexChanged
  If ComboBox1.SelectedText = "Pen" Then
    ComboBox2.Items.Clear
    ComboBox2.Items.Add("Mont Blanc")
    ComboBox2.Items.Add("Parker")
    ...

    ComboBox2.Text = "<Select a Pen Brand>"
  End If
End Sub



[修改]
所以,说真的,谁对我个人有问题,并一直以1的票数投票赞成我的答案?

我的信息确实不正确吗?不!

我的信息是否有用,因为它是针对另一种语言的(例如,用ASP.Net答案回答VB.Net问题)?不!

如果您对我有问题,请在论坛上发布一些内容...不要说出答案有误,这不会使人们感到困惑.



[Modified]
So, seriously, who is it that has a problem with me personally and keeps voting my answers as a 1?

Was my information factually incorrect? No!

Was my information unuseful because it was for a different language (like answering a VB.Net question with an ASP.Net answer)? No!

If you have a problem with me, post something in the forum...don''t confuse people by saying the answer is wrong, which it is not.


您可以尝试:

Visual Basic .NET傻瓜 [
You can try:

Visual Basic .NET for Dummies[^]

Try the chapter on "Showing Choices with List and Combo Boxes " I don''t have the book, so I can''t tell you what page and my VB books are at home.


您在这里:
CascadingDropDown演示 [使用AJAX创建CascadingDropDown [ ^ ]
Here you go:
CascadingDropDown Demonstration[^]

You can also make like this, step by step:
Creating a CascadingDropDown Using AJAX[^]


这篇关于当我在combobx中选择一个项目时,其子项目应出现在下一个组合框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆