|
You have to modify the DataGrids TableStyles collection to get at the column widths.
Dim ts As DataGridTableStyle = DataGrid1.TableStyles("columnName")
ts.Width = someValue
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I tried the one you suggested
Dim ts as datagridtablestyle = datagrid1.tablestyles(“REMARKS”)
Ts.preferredcoloumns = 100
I HAD THIS ERRORS
“Object reference not set to an instance of an object”
Kindly check pls.
Thanks alot for your time.
|
|
|
|
|
Sorry, I had rectal-cranial inversion...
DataGrid1.DataSource = ds.Tables("MyTable")
Dim ts As New DataGridTableStyle
ts.MappingName = "MyTable"
DataGrid1.TableStyles.Add(ts)
ts.GridColumnStyles(0).Width = 15
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry but it still has erros
I tried you codes but still I have one more error sending you my declarations
DECLARATION
Dim mytable As New DataTable
Dim ds As New DataSet
ON FORM LOAD
mytable.Columns.Add(New DataColumn("ContactPerson", GetType(String)))
mytable.Columns.Add(New DataColumn("DESIGNATION", GetType(String)))
mytable.Columns.Add(New DataColumn("PHONENO", GetType(String)))
mytable.Columns.Add(New DataColumn("EXTN", GetType(String)))
mytable.Columns.Add(New DataColumn("CELLNO", GetType(String)))
mytable.Columns.Add(New DataColumn("SALESMAN", GetType(String)))
mytable.Columns.Add(New DataColumn("REMARKS", GetType(String)))
Me.DataGrid1.DataSource = ds.Tables("mytable")
Dim ts As New DataGridTableStyle
ts.MappingName = "mytable"
DataGrid1.TableStyles.Add(ts)
Me.DataGrid1.DataSource = mytable
ts.GridColumnStyles(0).Width = 100
ERROS IS HERE (index is out of range: MUST BE NEGATIVE AND LESS THAN THE SIZE OF THE COLLECTIONS)
Thanks again for you help and you Suggestionss
Thanks again
Regards
|
|
|
|
|
It doesn't work because you reset the DataSource of the DataGrid, wiping out all the changes made to the TableStyles. Why are you adding all the Columns? You really don't need to unless your going to customize the look of them, which you're not doing in your code.
' I hope your DataSet actuall yhas a table in it called mytable.
' If not, this won't work. Change this to reflect the name of YOUR
' table in your DataSet.
DataGrid1.DataSource = ds.Tables("mytable")
Dim ts As New DataGridTableStyle
ts.MappingName = "mytable" ' Change this to match the name of the table in your DataSet
DataGrid1.TableStyles.Add(ts)
ts.GridColumnStyles(0).Width = 100
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Finally I was able to resize it, Thanks for your Help and Support
The codes are as Under for reference
Dim mytable As DataTable
mytable = New DataTable("MAIN")
mytable.Columns.Add(New DataColumn("ContactPerson",GetType(String)))
mytable.Columns.Add(New DataColumn("DESIGNATION",GetType(String)))
mytable.Columns.Add(New DataColumn("PHONENO",GetType(String)))
DataGrid1.DataSource = mytable
Dim TS As New DataGridTableStyle
TS.MappingName = "MAIN"
DataGrid1.TableStyles.Add(TS)
TS.GridColumnStyles.Item(1).Width = 100
TS.GridColumnStyles.Item(0).Width = 100
Thanks Again for your time
|
|
|
|
|
Pravin Hegde wrote: The codes are as Under for reference
Precisely why you keep it in the forums!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So that if anyone has the same problem he can get an idea to how to do it !!! Just a helping hand like you which you always do.
Thanks
|
|
|
|
|
When I add a new addin to microsoft excel, where does this store this information in the registry? for eg, i have an addin say MyAddin.xla and I add manually from excel. Then it gets displayed in list of macros, which I can then disable or enable as I want. Where is this information stored in the registry?
Thanks
Aljechin Alexander
|
|
|
|
|
XLAs get stored in HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Options and Excel opens them, in order, first with the template pointed to by OPEN, then OPEN1, then OPEN2, and so on.
This article talks about COM and Automation Add-Ins[^].
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thank you so much for your help. I will check the same and get back to you.
Aljechin Alexander
|
|
|
|
|
I am using "ctrl" as prefix for naming my windows controls instead of Hungarian Notation. e.g. ctrlName for Name textbox control. Is it better?
---------------------------------------
I have a Persistent Class e.g. Person.
Public Class Person
Dim _name as string
Dim _age as int
Public Property Name
...
End Property
Public Property Age
...
End Property
End Class
Now I want to use Person Class as parameter in a method. can I use the same name for Parameter as class name.
e.g.
Public Function GetPersonDetail(person as Person) as boolean
...
End Function
I use the same for defining variables within a class.
e.g.
Public Sub SetPersonDetail()
dim person as Person
msgbox (person.Name)
End Sub
if not can you suggest some.
Ganesh P. Thanks for your help in advance
|
|
|
|
|
GaneshParam wrote: I am using "ctrl" as prefix for naming my windows controls instead of Hungarian Notation. e.g. ctrlName for Name textbox control. Is it better?
Ummmm.... Using "ctrl" as prefix for naming my windows controls is Hungarian notation[^].
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
I use a combination of Hungarian and not.
Variables do not have any notation prefixes except for a leading m for module level variables of a class.
Controls I still prefix with a control prefx (cmd for Button, cmb for ComboBox, etc..) just to I can discern them from the regular vars in the code.
As a rule properties are the same name as the variable they offer access to:
Private mAge As Integer
Public Property Age() As Integer
. . .
End Property
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
Hi,
I am developing an appls in VB.Net. I want the user to keyin some information on the first page. I want to pass this information to subsequent pages. i.e. I want to access the information throughout the application.
* How do store the information in a variable?
* How do I access the information in different forms in the application?
With Regards,
Mayur
|
|
|
|
|
i need a example on winsock program in VB
Paritosh
|
|
|
|
|
Try this link[^] it would help you.
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
hi all,
i just Want To create a program with a datagrid, connectrion , and recordset object.
My problem is that data grid does not show the records in it.and gives no Error
please solve my Problem.
the Coding i use
Option Explicit
dim rec As new ADODB.Recordset
Dim con As New ADODB.Connection
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim str As String
With con
.Open ("Provider=Microsoft.jet.oledb.4.0 ; data Source=C:\Documents and Settings\Administrator\Desktop\vc.mdb")
End With
'Set rec = New ADODB.Recordset
str = "select * from invtrans"
'If con.Open = adstaeopen Then con.Close
rec.Open str, con, adOpenStatic, adLockOptimistic
'MsgBox rec.RecordCount
'rec.MoveFirst
MsgBox rec.Fields(1)
Set DataGrid1.DataSource = rec
'Set DataGrid1.DataBindings = rec
End Sub
manoj
|
|
|
|
|
Friend ,I too faced this problem at lot time.
i tried a method and added a ADO control on the form . Connect the control in the code and pass the recordsource i.e ur SQL statement and then set datagrid's datasource using this control.
I think it can solve ur problem . In case u find another solutions please do let me also know abt that.
deepaish
|
|
|
|
|
ashu
|
|
|
|
|
how to ask a question :
1. speak english
2. use the thread title as a very short summary
3. use the thread body to actually ask your question instead of your boring " "...
4. hope that someone will close one's eyes on this...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 6:10 Monday 9th January, 2006
|
|
|
|
|
You're asking a very general question. One which, just by asking it, tells us you don't understand the basics of developement. It sounds as if your in over your head.
If you don't understand how your data works on paper, no one here can describe it to you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
HI
CAN ANY ONE TELL ME WHAT IS A "WINSOCK" AND "MAPI" CONTROLS AND THE USES.
ITS URJENT.
BYE
Paritosh
|
|
|
|
|
MAPI: MAPI is an acronym for Messaging Application Programming Interface. MAPI allows client programs to become (electronic mail) messaging-enabled.
Winsock is an alias for Windows Sockets enables programmers to create advanced Internet, intranet, and other network-capable applications to transmit application data across the wire, independent of the network protocol being used (retrieved from msdn).
I hope it helps,
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
which protocol winsock uses while transfering data
Paritosh
|
|
|
|