|
here is datagridview1 the name of the datagrid?my datagrid does not have the property displayrowcount at all.
more dash than cash!!!
|
|
|
|
|
i m using vs.net 2005
i think u r using vs.net 2003
if u r filling the datagrid from database using dataset here is another way:
Dim i As Integer<br />
i = CInt(dst.Tables(0).Rows.Count)
abhinav
|
|
|
|
|
the method suggested by abhinish is the only way to do it in vs.net 2003.
With Best Regards,
Mayur
|
|
|
|
|
When we call some build-in function of VB.NET,
it will have a box to tell us what the method done,
what the result returns.
How can I make my own function have that description of function?
Besides, How to make a function parameter optionally?
Thank you!
|
|
|
|
|
Your first question has been asked lots of times just search this forum for it.
The second one is well documented in the official help but basically:
friend function X (optional byval s as integer = 1) as integer
|
|
|
|
|
how to execute a query in visual basic using a xml call..instead of using connection string.i also want to know the count of values from the executed query using xml
regards
shabari
|
|
|
|
|
Sir,i have created two dynamic controls and bind it to the grid .but the problem is i can't add these controls to the grid and after adding how could i get these controls in the next row of the grid and also i couldn't tke values from the control. hre i s code thsat ihve written.
Private Sub CreateTable()
If Session("DYNA") Is Nothing Then
dtTemp = New DataTable
dtTemp.Columns.Add("sct", GetType(Control))
dtTemp.Columns.Add("scr", GetType(Control))
Session("DYNA") = dtTemp
Else
dtTemp = CType(Session("DYNA"), DataTable)
End If
End Sub
Private Sub bindTable()
DataGrid2.DataSource = dtTemp
DataGrid2.DataBind()
End Sub
Private Sub FillGrid()
Dim sql As String
Dim DT1 As New DataTable
Dim obj As New clsValidation
sql = "SELECT Firstcol,Secondcol from Dynamic where code='1' "
DT1 = obj.ReturnDataTable(sql, strconnect, erpath)
Dim i As Integer
For i = 0 To DT1.Rows.Count
If Trim(DT1.Rows(0).Item(i)) = "TextBox" Then
createTextBox()
ElseIf Trim(DT1.Rows(0).Item(i)) = "CheckBox" Then
createchkbox()
ElseIf Trim(DT1.Rows(0).Item(i)) = "ListBox" Then
createListBox()
ElseIf Trim(DT1.Rows(0).Item(i)) = "RadioButton" Then
createRadBox()
ElseIf Trim(DT1.Rows(0).Item(i)) = "DropDown" Then
createDropDown()
ElseIf Trim(DT1.Rows(0).Item(i)) = "LinkButton" Then
createLinkButton()
End If
Next
bindTable()
End Sub
Private Sub createTextBox()
Dim i As Integer = 0
Dim z As Object
Dim tb As New System.Web.UI.WebControls.TextBox
tb.Visible = True
tb.BorderStyle = BorderStyle.Double
tb.BackColor = y
tb.ID = "TextBoxID" + i.ToString()
i = i + 1
display(tb)
End Sub
Private Sub display(ByVal ctrl As Control)
Dim dr As DataRow
dr = dtTemp.NewRow
dr(0) = CType(ctrl, Control)
dtTemp.Rows.Add(dr)
End Sub
Private Sub DataGrid2_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid2.ItemCommand
If TypeOf e.CommandSource Is LinkButton Then
Dim lnkTemp As New LinkButton
Dim btn As Button
Dim txtTemp As LiteralControl
Dim ctrl As Control
lnkTemp = CType(e.CommandSource, LinkButton)
Select Case Trim(lnkTemp.Text)
Case Is = "Add"
Dim drs As DataRow
drs = dtTemp.NewRow
ctrl = CType(e.Item.Cells(2).Controls(0), Control)
drs(0) = ctrl
dtTemp.Rows.Add(drs)
bindTable()
End Select
End If
End Sub
Private Sub DataGrid2_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid2.ItemDataBound
Dim i As Integer
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.Footer Then
If dtTemp.Rows.Count > 0 Then
For i = 0 To dtTemp.Rows.Count - 1
e.Item.Cells(i).Controls.Add(CType(dtTemp.Rows(i).Item(0), Control))
Next
End If
End If
End Sub
|
|
|
|
|
Hi Guys,
Can someone tell me how we can add tool tip text to a command button. This property was available in VB. When the cursor moves over a command button, some text would be displayed. Which is the property in VB.Net for a command buttonto set the same. Thnx.
With Best Regards,
Mayur
|
|
|
|
|
You can add a ToolTipProvider to your Form, then every control gets a property called ToolTipText or something.
HTH
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
Hey Marc,
Thnx a lot. Is there a way to add the tool tip provider to the project so that we do not have to add it to each and every form.
With Best Regards,
Mayur
|
|
|
|
|
Uh i don't think so, but you can make a base form (let's call it ToolTipForm ). In the ToolTipForm you put a protected access ToolTipProvider. Then you let every other form in your project inherit from that ToolTipForm instead of Form. I think you get what you want this way.
Laters
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
Thnx Marc. I guess I will manage with adding a tooltip ctrl to every form rather than adding a new form to the application. Thnx for your help.
With Best Regards,
Mayur
|
|
|
|
|
Hi there,
I am just trying to populate crystal report with customers data from
Northwind database. The below is the code.
It doesn't return any error and i can see the report in the front but
the report is empty. It doesn't have the data in it. i am i missing
some thing here?
Please help thanks
-L
**********************************
code*********************************************************
Dim rpt As New CrystalReport1
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand
Dim myDA As New SqlDataAdapter
Dim myDS As New Dataset1
Try
myConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind;")
MyCommand.Connection = myConnection
MyCommand.CommandText = "SELECT * FROM Customers"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "Customers")
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
**************************************** end of the code
******************************************
|
|
|
|
|
u didnt specify user name and password in the connection string
also check the dataset1 which u r using if populating or not.
abhinav
|
|
|
|
|
Hi,
Any suggestion on efficient way for importing data from Excel to Database by program?
Many thanks and regards,
WiL
|
|
|
|
|
Do you mean XLS files, or via Excel itself ? Would you accept a solution that involves Excel being on the target machine ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I mean local XLS files. I want to browse for the XLS files, read content and then import them to my database.
Many thanks and regards,
WiL
|
|
|
|
|
OK - if you want to do this on machines that don't have Excel, I'm not sure that there's a solution beyond learning the file format, and writing code to parse it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
With regard to your email - no, I won't send you any code. You will need to write it yourself.
I don't have code to do this, what makes you think I do ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
No no no. I'm not asking for any code. I'm asking about an "efficient way" or "best practice" or etc.
Thank you
WiL
|
|
|
|
|
I apologise. Someone ELSE sent me an email that said 'please send me code for this problem'. I assumed it was you.
I don't see any terribly efficient way of doing this, unless your users all use a new enough version of Excel that they can save as XML.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks CG. Looking foward for more helps from you in future
WiL
|
|
|
|
|
hi there,
I need to access an unknown number of controls, that may be added by a user to my a usercontrol and each control must fire the same event!
i think this is the only way possible that i can do it!
for example..imagine a panel and add three buttons to it...then on each mouse enter of each button the same event is triggered, i have tried a number of ways but all failed.
please help
thanks
|
|
|
|
|
Create a single method in your code, and tie the event of each control to that method.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Or, if your adding these controls dynamically, look into AddHandler[^]. Don't forget to lookup it's opposite, RemoveHandler.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|