473,396 Members | 1,975 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.

listbox for fontname,combo for size,color,etc,help

Hii I am desigining one VB project like dis..


VB application to change the font of the textbox... use the controls list box for the fontname, check box for Effects , combo box for sixe, combo box for color, and option button for font style....

I have written the code for loding font names and font sizes in a list box... but i am unable to get rest of the things.. please help me regarding this.... thank you....

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. For i = 0 To Screen.FontCount - 1
  3. List1.AddItem Screen.Fonts(i)
  4. Next i
  5. End Sub
  6. Private Sub List1_Click()
  7. LoadFontSizes
  8. End Sub
  9.  
  10. Private Sub LoadFontSizes()
  11. Dim SaveName As String
  12. Dim SaveSize As Single
  13. Dim Sizes As Variant
  14. Dim i As Long
  15. 'place holders for font name and font size
  16. SaveName = cboFontSize.Font.Name
  17. SaveSize = cboFontSize.Font.Size
  18. Sizes = Array(6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72)
  19. cboFontSize.Clear
  20. 'this is the font the user has selected
  21. cboFontSize.FontName = List1.Text
  22. 'whip through the array checking all possible font sizes
  23. For i = LBound(Sizes) To UBound(Sizes)
  24. cboFontSize.FontSize = CLng(Sizes(i))
  25. 'font supports this size, add to combo
  26. If cboFontSize.FontSize = CLng(Sizes(i)) Then
  27. cboFontSize.AddItem Sizes(i)
  28. End If
  29. Next
  30. cboFontSize.FontName = SaveName
  31. cboFontSize.FontSize = SaveSize
  32. End Sub
Apr 6 '10 #1
5 3172
vb5prgrmr
305 Expert 100+
Why reinvent the wheel? Use the common dialog control and the showfont and the showcolor methods to accomplish what you want. Fewer lines of code, common interface, and in moments, you are done....



Good Luck
Apr 6 '10 #2
hii thanks for ur reply...... that is true about using common dialog controls... but my requirement is to create our own font dialog boxes using the above controls... please help me regarding this.... thank you,,,,,,,,,,,,
Apr 6 '10 #3
CyberSoftHari
487 Expert 256MB
Explain your project properly, not the code. Your code looks a bit harder than common dialog tools for the endusers.
(You can create yourown controls(.ocx) for your project using get and set property).
Apr 6 '10 #4
Hii I am desigining one VB project like dis..


VB application to change the font of the textbox... use the controls list box for the fontname, check box for Effects , combo box for sixe, combo box for color, and option button for font style....


thank you
Apr 6 '10 #5
CyberSoftHari
487 Expert 256MB
If your project endusers interface are highly based on design then you can create own controls as i sugges else, you can use common dialog controls.
Apr 6 '10 #6

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

Similar topics

4
by: Mark B | last post by:
It seems the Access 97 FontName property supports multiple font names, e.g. "Franklin Gothic Medium, Tahoma". I assume that means that if the first font is not available on the target PC, the...
9
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
0
by: David J | last post by:
Hi, I am strugling with the propertygrid and a listbox. I am using the universaldropdowneditor from the codeproject (code below). However I am populating the listbox via a datasource. The problem...
3
by: Ali Chambers | last post by:
Hi, I have created a listbox called "dtlist1" on my VB.NET form. I call a procedure as follows: Private Sub openfile(flname As String) dtlist1.Items.Clear() etc..
3
by: Kevin Walzer | last post by:
I'm trying to set the active item in a Tkinter listbox to my application's currently-defined default font. Here's how I get the fonts loaded into the listbox: ...
14
by: rdade22 | last post by:
I have a combo box (cboStore) and a listbox (Qlist) both are unbound to a form call frmFAQ. What I want is to be a able to select a Subject from the combo box and have the results show up in the...
3
by: deejayquai | last post by:
Hello Simple one this I guess, but I'm quite stuck at the moment. I would like to update the records displayed in my listbox (lstStudents) using criteria selected from my combo (cboForm) in a...
20
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
9
by: weirdguy | last post by:
Hello, Just for anyone information, there is a similar title "Search in Listbox" but it is via Combo Box. In case, anyone need it, I put a link to here. Please let me know if I break any rules...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.