|
HI CP ,
Location : Areas, Countries , Capitals
Item List : property selected in Location and load items in Item List
I am having 1 property with drop down : Areas, Countries , Capitals
suppose if i select the Areas then i have to load dynamically Areas thru the .txt file
and if i clicked countries then i have to load dynamically
and the same .
How can i do this Dynamically ?? while clicking the particular item .
Regards,
|
|
|
|
|
If I'm following you correctly, each combo is dependent off another. I'm assuming you have some kind of a settings class (with related classes for the combo(s)?) that the property grid is set to.
You could in the settings class, for each property set statement, parse the text files and update the values for the other properties as needed, which would update the values in the combo(s).
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi CP
This is my code i am retrieving a property value which raises the error
Public Class cTxtBoxProperties
<Category("Misc")> <Description("Displays the type of data associated with the control")> _
<TypeConverter(GetType(MyDataType))> _
Public Property DataType()
Get
Return _DataType
End Get
Set(ByVal value As Object)
_DataType = value
End Set
End Property
<Category("Misc")> <TypeConverter(GetType(NumberFormats))> _
<Description("Displays the format of the control")> _
Public Property Format() As String
Get
Return _Format
End Get
Set(ByVal value As String)
_Format = value
End Set
End Property
End Class
Dim tPropertyName As String = "DataType"
Dim objTxt As Type = GetType(cTextBoxProperties)
Dim PiInfo As PropertyInfo = objTxt.GetType.GetProperty("DataType")
Dim ObjPropertyValue As Object = PiInfo.GetValue(objTxt, Nothing)
Public Class NumberFormats : Inherits System.ComponentModel.StringConverter
Dim alist As New ArrayList
Dim ControlNames() As String
Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
alist = New ArrayList
alist = GetNumberFormats()
ControlNames = CType(alist.ToArray(GetType(System.String)), String())
Return New StandardValuesCollection(ControlNames)
End Function
Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
Return True
End Function
Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
Return True
End Function
Protected Friend Function GetNumberFormats() As ArrayList
GetNumberFormats = Nothing
Dim objFStream As FileStream = Nothing
Dim objReader As StreamReader = Nothing
Dim fiInfo As FileInfo = Nothing
Dim tFontSizeFilePath As String = ""
Dim tNumberFormats() As String
Dim alist As New ArrayList
Dim CTextbox As cTextBoxProperties = Nothing
Dim tFileName As String = ""
Try
'' Here Raising the ERROR
Dim tPropertyName As String = "DataType"
Dim objTxt As Type = GetType(cTxtBoxProperties)
Dim PiInfo As PropertyInfo = objTxt.GetType.GetProperty("DataType")
Dim ObjPropertyValue As Object = PiInfo.GetValue(objTxt, Nothing)
<b>'' Here Raising the ERROR </b>
tFontSizeFilePath = String.Concat(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, tFileName)
fiInfo = New FileInfo(tFontSizeFilePath)
If fiInfo.Exists Then
objFStream = New FileStream(tFontSizeFilePath, FileMode.OpenOrCreate, FileAccess.Read)
objReader = New StreamReader(objFStream)
While objReader.Peek <> -1
alist.Add(objReader.ReadLine.ToString.Trim)
End While
objReader.Close()
objFStream.Close()
Return alist
Else
MsgBox(tFileName & "is not existed in Application Path.")
Exit Try
End If
Catch ex As Exception
MsgBox("GetNumberFormats : " & Err.Description, MsgBoxStyle.Critical)
Finally
If Not fiInfo Is Nothing Then fiInfo = Nothing
If Not objFStream Is Nothing Then objFStream = Nothing
If Not objReader Is Nothing Then objReader = Nothing
If Not CTextbox Is Nothing Then CTextbox = Nothing
Erase tNumberFormats
End Try
End Function
End Class
Regards
|
|
|
|
|
how can I include solid works 3D images in my vb.net project which have extensions of sldprt,Is there any chance to do so through vb.net only or some think components to included in to that?
|
|
|
|
|
You'd be better off looking at the company's site to see if you can tie into their .dlls/apis.
Some links I found from Google:
http://www.solidworks.com/sw/support/1835_ENU_HTML.htm
http://www.cadsolutions.ca/magazine/api.asp
http://lmgtfy.com/?q=solidworks+api
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi,
I'm currently working on a 2D game engine for my RPG. Now the work on the physics engine is almost done, but the graphics are seems to be the biggest problem. I'm using VB 2008 and for the graphics - GDI+ . Almost all of the objects in my game are *png images, with smooth shadows and so on... I'm drawing the objects using two methods: the first one sets the drawing priority so that no one player can step on the head of other players. The second one is the loop that draws all the objects(players and textures) on the playground, that loop uses the GDI+ Graphics.DrawImage function and all this code looks like this:
'this subroutine sets the draw priority:
Sub SetObjDrawPriority()
For i = 0 To UBound(HBD)
Select Case HBD(i).booIsAlive
Case True
intDrawPriority(i) = HBD(i).intTop
End Select
Next
Array.Sort(intDrawPriority)
End Sub
Sub DrawAllObjects(ByVal e As System.Windows.Forms.PaintEventArgs)
Try
SetObjDrawPriority()
For i = 0 To UBound(HBD)
For i2 = 0 To UBound(HBD)
If HBD(i2).intTop = intDrawPriority(i) Then
e.Graphics.DrawImage(HBD(i2).bmpFace, HBD(i2).intLeft, _
HBD(i2).intDrawTop, HBD(i2).intWidth, HBD(i2).intObjDrawHeight)
End If
Next
Next
Catch ex As Exception
End Try
End Sub
If I use *bmp texture for the objects with this size: 51 x 86 I can move simultaneously more than 200 objects on the visible area of the screen which is great, but If I replace the *bmp with *png images(with the same size: 51 x 86) the performance goes so bad that I can move normally less than 40 objects! Please tell me whats wrong. Is there any problem with the GDI+? I heard that GDI+ is wery slow and most of the programmers avoid it. I think that the code is pretty simple, but anyway maybe I'm wrong, please tell me how to optimize the code in case to get better performance.
Thank you.
|
|
|
|
|
Maybe because png pic´s are compressed?
|
|
|
|
|
PNG's are compressed images. They have to be uncompressed to draw them. If you're requiring that kind of performance, look into the XNA Framework.
|
|
|
|
|
I've never heard before that PNG is compressed is there an uncompressed PNG format?
I'm currently learning C++ but I'm only on the beginning so I can't move that fast to XNA, cause as I know XNA requires C++ or C#.
|
|
|
|
|
O.G.I. wrote: I'm currently learning C++ but I'm only on the beginning so I can't move that fast to XNA, cause as I know XNA requires C++ or C#.
Nothing like trial by fire right? You could always give a try and post questions when you get stuck.
Ping compression details
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi,
I don't see where the image's fileformat would be relevant, assuming you load the images into memory once (hence outside your drawing methods), which turns them into uncompressed bitmaps anyway, e.g. using Bitmap bm=Bitmap.FromFile(filepath); or something similar with FromSream. (example is C# syntax!).
PS: I strongly object to your code swallowing exceptions; if you (think you) need a try-catch, then do something useful with the exception, e.g. display it's Exception.ToString().
[ADDED]And if there is a very specific exception that you rightfully want to ignore, add a catch for that specific exception and insert a comment as to why it is OK to ignore it; then leave the more general catch out, or put some code in it.
[/ADDED]
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
modified on Thursday, June 25, 2009 10:44 AM
|
|
|
|
|
how can i fire a form through tree view node click event.
|
|
|
|
|
Create object of the form and use Show or ShowDialog method (as applicable).
|
|
|
|
|
thanks for u r replay my problem is in the tree node selction program
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Dim childnum, index As Int32
childnum = TreeView1.SelectedNode.GetNodeCount(False)
index = TreeView1.SelectedNode.Index
'index = index + 1
If index = 0 Then
Button2.Show()
GroupBox1.Show()
End If
End Sub
The Above function is not working for me to select tree node and fire,is there any thing wrong in tn my prg.
|
|
|
|
|
I'm not sure I'm completely following you here. The controls are displayed when the index is 1 right? What else are you expecting to occur?
Also, check that you have at least 2 nodes in the treeview since the index is zero based.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I tried the aabove code by making a button visable false and on selcting a perticular treenode it will appear but the same code is not working for the group box that consits of some group of buttons.
I want make that group box visable when i click on a perticular treeview node.
|
|
|
|
|
I tried the aabove code by making a button visable false and on selcting a perticular treenode it will appear but the same code is not working for the group box that consits of some group of buttons.
I want make that group box visable when i click on a perticular treeview node.One more thing i have i have 8 child nodes for my tree so thre is no problem of zero index base.
|
|
|
|
|
Your code looks like it should work. Check the visible property (should be true) on the button controls in the group box to see if visible = true. If not, you'll need to change that at design time or during run time looping the groupbox's control collection.
Quick test app you can do.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'add a group box and stuff with button controls
For Each ctl As Control In GroupBox1.Controls
ctl.Visible = True
Next
GroupBox1.Visible = False
End Sub
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
If e.Node.Index = 5 Then
GroupBox1.Visible = True
End If
End Sub
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Thanks Jon_Boy Your code is working for me.
|
|
|
|
|
TreeViewEventArgs has all the properties you need. You can use them right away.
Apart from that what exactly is the problem you are facing.
|
|
|
|
|
How does one initiate windows hyperlink dialog selector. By this I do not mean the link label. There is a dialog that is called in C++ with "using (LinkDialog dlg = new LinkDialog())"
With the other dialogs you (color, font, etc) you add them via a control in the toolbox, but I do not find a LinkDialog.
Many thanks
|
|
|
|
|
There is no using statement in C++. Also, if a control exists in MFC, does not mean it exists in .NET. Do you have a link to the control you want, in MSDN ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi Christian,
Ok you are correct. I am currently busy converting a project from C++ to VB.NET (why I dunno but here I find myself doing this) I only notice now amongst the millions (ok not quite millions) of classes and forms and other resources that the previous guy made a LinkDialog class which basically has a textbox to indicate what text must be show and a URL textbox for the link and a dropdown to select target. So that is where it comes from.
So basically I just make another one. Thank you
|
|
|
|
|
Program that someone else wrote. (ProgA)
Program that I wrote. (ProgB)
DLL that someone else wrote (i have the cls file) and I have modified. (DLL1)
I have sample code with an attempt to accomplish my goal if needed.
When ProgA sends a message to DLL1, I need ProgB to see the results of the call from ProgA to DLL1.
|
|
|
|
|
A dll can't call your main app. So, you want to load the same dll instance into both programs. I am not sure if that is possible. Your best bet IMO would be for the dll to use WM_COPYDATA or similar to communicate with the other program, or create some sort of shared storage for the dll to use between instances.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|