|
If my datagrid is readonly = true.
Then it cannot be modified from inside datagrid but i want to allow deletion of row if 1 or more rows are selected and this is event raised after the delete button is pressed.
How will i code this
|
|
|
|
|
You don't delete anything out of the datagrid. You delete the records out of the underlying datasource, then refresh the datagrid.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
tnx i have made it! using the command
index = datagrid.currentrowindex()
ds.Tables("tablename").Rows.RemoveAt(index)
i can delete the selected row from record on the datasource
a follow up question
how can i delete the records underlying the datasource, if i have selected 2 or more rows for deletion? because the command can only delete one row.
|
|
|
|
|
how TO ADD CRYSTAL REPORT TO WINDOWS APPLICATION
|
|
|
|
|
Add Crystal report component to your application. Are u using VB/ VB.NET?
<italic>Work hard, Work effectively.
|
|
|
|
|
How can I print the html code which I get as a parameter to the function. If I use "Printer.print" then it prints the html tags itself(ie......) But I want to print the output as it is shown in the web browser.
|
|
|
|
|
If you want to print it as HTML, you need to print it from a browser. You can embedd IE in your app.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I will explain you the whole scenario. I have an asp page (say print.asp) which generates reports depending upon the id passed to it(print.asp?id=52). I want to print this document using the printer on the server where asp application is installed.
For this I haev written an ActiveX dll in VB 6.0. So wht I'm currently doing is.... Reading the html of the asp page and passing the html code to the ActiveX dll.. I'm passing the html code to preserve the formatting of the page.
DO you have any other ideas for this kind of Scenario. or may be as u mentioned in ur reply ... how to embed IE in the ActiveX dll.
Thanks a lot Christian.
|
|
|
|
|
Adarsh Shah wrote:
how to embed IE in the ActiveX dll.
I doubt you can, I reckon you need a GUI app to do that.
I don't see how else you can parse HTML though. Why do you want the server to print it, can't you render it to a window on the server and print from there ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ok..
1) Can I open an IE browser from the activeX dll which will have the link to the asp page (ie print.asp?id=52). and then print it some way that doesn't ask for print prompt.
2) Or may be I can call a VB application with WebBrowser control and print it.
3) Or I found something: which blocks the print dialog box .. and I can specify the direct path of the print page
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
a = Shell("rundll32.exe mshtml.dll,PrintHTML " & """" & temp & """") '""C:\a.html""")
wnd = FindWindow(vbNullString, "Print")
While wnd = 0
wnd = FindWindow(vbNullString, "Print")
Wend
Call Sleep(100)
AppActivate "Print" 'PageCount
SendKeys "{ENTER}", True
I think the 3rd method is the best one... Any suggestions on this?
Thanks again Christian.
|
|
|
|
|
Adarsh Shah wrote:
Any suggestions on this
I think it sounds the best as well, but the truth is I'm on the edge of my VB ability. Hopefully Dave will step in and fill the gaps for me.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ok Fine.. Thanks Christian.
|
|
|
|
|
1) Won't work. You don't have and can't put into your ASP.NET app, a Windows Form to host the control.
2) Will kind of work, but is a pain to work with. Since IIS doesn't interact with the desktop, the application is launches will never see the light of day.
3) Best option and least resource intensive.
I can see a couple of pitfalls if your code is not written correctly. When you save the HTML to a file to print, make sure your code gets a temporary filename from the system (there's an API for it, but I can't remember what it's called off the top of my head).
Also, you MIGHT have a problem with FindWindow, since this is dependent on having one. No desktop, means no window. Whether this works will depend on IIS (I'm no expert on it.) You'll just have to try it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I will try out the 3rd option and let u know how it went.
Thanks a lot Dave.
|
|
|
|
|
I created a console app using vb.net called MyApp.exe. The application is designed to use MyApp.exe.config. However, I cannot read any of the values in the config file. I get blank/null values for strDBConn when I use either of the following statements.
strDBConn = ConfigurationSettings.AppSettings("DBConnectionString").ToString
or
strDBConn = ConfigurationSettings.GetConfig("DBConnectionString").ToString
What am I missing?
Thanks,
Sam
|
|
|
|
|
Hi everyone,
I just want to ask what could be the fastest way to read a 2.3GB Sequential File in VB.NET? Below is the sample content of the file that I need to process(i.e Field Cound,Record Count, Edit Field Value,Remove Field Value, Insert New Record). Basically you will see RECORD TAGS(first 2 characters in each line - H0, A0, A1, A2, A3, A4, C0, C1 etc..)
H002/4810/03/4865000 200140 11163992 5 502D0312142055-298162 298162 A0
A0SAMPLE A. SAMPLE
A11234 ANYWHERE ST.
A2LOCATION SOMEWHERE
A3CITY OF ANGELS
A4ZIP12345
C0 100.00 30.00 117.00 534.00
C1 781.00 835.67 54.67 781.00
C221/02/4800005041 39
T0025842439 11564921/01/48SAMPLE LINE1 2 4.00
T0012840937 16050121/01/48SAMPLE LINE2 1 3.00
T0069263013 20212521/01/48SAMPLE LINE3 2 6.00
T0069263013 20251821/01/48SAMPLE LINE4 1 3.00
T0069263013 21541421/01/48SAMPLE LINE5 1 3.00
T0 ** TOTAL ** 150 534.00
A0SAMPLE B. SAMPLE
A11234 ANYWHERE ST.
A2LOCATION SOMEWHERE
A3CITY OF ANGELS
A4ZIP12345
C0 100.00 30.00 69.00
C1 199.00 212.93 13.93 199.00
C221/02/4800004848 23
A0SAMPLE C. SAMPLE
A11234 ANYWHERE ST.
A2LOCATION SOMEWHERE
A3CITY OF ANGELS
A4ZIP12345
C0 100.00 66.00 485.00
C1 651.00 696.57 45.57 651.00
C221/02/4800005698 22
T0097032980 15184121/01/48SAMPLE LINE1 1 2.00
T0062114547 12012822/01/48SAMPLE LINE1 1 2.00
T0097032980 13101022/01/48SAMPLE LINE1 2 4.00
T0097032980 13191322/01/48SAMPLE LINE1 1 2.00
T0040483534 08590724/01/48SAMPLE LINE1 1 2.00
Thanks/Regards
Sidney™
|
|
|
|
|
Hi everyone... just a follow up on my question above May be you can give me some input on how to acheive this. Co'z honestly all i can think of right now is to use Line Sequential Access, I dont think i can use BinaryReader right?
Thanks/Regards
Sidney™
|
|
|
|
|
how to make a label control grow in height with width constant at runtime (to show its entire contents) in vb.net?
|
|
|
|
|
Hello,
To change the width/height of a label control during run-time use:
Label.Width = SizeInteger<br />
Label.Height = SizeInteger
If you want the growth animated, use a timer control and some code similar to:
If Label.Width < MaximumWidthInteger Then Label1.Width += 1<br />
If Label.Height < MaximumHeightInteger Then Label1.Height += 1
I hope this helps,
Mitch
My sig:
"And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright
Get Perpendicular! (Hitachi Storage)
My CodeProject Blog
Most recent blog post: April 11
|
|
|
|
|
This is my first post to this discussion board so please forgive me if I am not yet following all your posting rules. I have a simple question about wrapping headers in a listview.
Is it possible to wrap a header row in a listview so that the header row wraps on words to two rows? I am reading in a text file that contains the header data and the row data but some of the headers are verbose so I need them to wrap to two lines. Code included below.
Private Sub PopulateTable(ByVal name As String)
Me.Controls.Add(Me.ListviewTable2)
FsrStreamReader = New System.IO.StreamReader("PreviousSaves.txt")
'Use this variable to store a read line from the file
Dim sLineFromFile As String
FbReadingFirstLineOfFile = True
'First of all clear the listview completely
Me.ListviewTable2.Clear()
Me.ListviewTable2.Show()
'While our streamreader is not at the end of the file
While FsrStreamReader.Peek <> -1
'Read in the next line from our textfile
sLineFromFile = FsrStreamReader.ReadLine()
'If this is the first time that we read a string from the file, we take this string as the collection of columnheaders
If FbReadingFirstLineOfFile Then
'Split the string using the tabs between the columnheaders in the file
'Loop trough our split collection and for every columnheader we add a column to our listview
For Each sColumnHeaderString As String In sLineFromFile.Split(vbTab)
Me.ListviewTable2.Columns.Add(sColumnHeaderString, 125, HorizontalAlignment.Right)
Next
'We can reset this flag, the next lines is data, not columnheaderinfo
FbReadingFirstLineOfFile = False
'This is not in the first line from the file. We've read data now
Else
'Split the string using the spaces between the data chunks in the file
'Add an item (and it's subitems) directly by using the split array.
Me.ListviewTable2.Items.Add(New ListViewItem(sLineFromFile.Split(vbTab)))
End If
End While
'Close the streamreader to free the file
FsrStreamReader.Close()
End Sub
|
|
|
|
|
Hello,
I got a control which display some data from RSS feed in my page.
In my aspx.vb I need to change some Labels and Images properties, used
by the control, when the culture is changed.
For that I created a function named Build_RSS()
Private Sub Build_RSS(Dim Culture As String)
Dim img As System.Web.UI.WebControls.Image =
cnews.FindControl("_ctl0").FindControl("imgLogo")
img.AlternateText = "New Text"
End Sub
It's not working!
Then I tried this:
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.PreRender
Dim img As System.Web.UI.WebControls.Image =
cnews.FindControl("_ctl0").FindControl("imgLogo")
img.AlternateText = "New Text"
End Sub
This works!
I got informed that the control loads RSS feed and build object model in
OnLoad event handler, which occurs exactly after Page_Load event.
Anyway, I am lost.
How can I make my Build_RSS function to work?
Can someone tell me what do I need to change or add in my code?
Thank You,
Miguel
|
|
|
|
|
You might want to post this in the ASP.NET Forum[^]...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am getting the message "Thread was being aborted" when I do a response.redirect in the code.
My code is:
If A=1 Then
Response.Redirect("url")
Anyone any ideas why I a getting this?
|
|
|
|
|
You might want to try the ASP.NET[^] Forum for this question...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to get an orderId back from my table and could not. I create a stored procedure did not work. I use the select statement with where clause and did not work as well. Could someone help. Here is my code in stored procedure and select statement.
====================================================
CREATE PROCEDURE proc_getID
(@OrderId int out,
@CustomerName varchar(50)
)
As
SELECT @OrderId, @CustomerName FROM Orders WHERE Orders.CustomerName = @CustomerName
GO
==================================================================
Dim ConnStr As String
Dim SQL As String
ConnStr = "server=(local);database=Orders;uid=sa;pwd="
Dim MySqlConn As New SqlConnection(ConnStr)
MySqlConn.Open()
'''''''''''''''''''''''''''''''''''''''''''''''''
'''' I used select statement here '''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim myCommand As New SqlCommand("SELECT @OrderId ,@CustomerName FROM Orders WHERE CustomerName = @CustomerName", MySqlConn)
myCommand.Parameters.Add(New SqlParameter("@OrderId", SqlDbType.Int))
myCommand.Parameters.Add(New SqlParameter("@CustomerName", SqlDbType.VarChar, 50))
myCommand.Parameters("@CustomerName").Direction = ParameterDirection.Input
myCommand.Parameters("@CustomerName").Value = "steve"
myCommand.Parameters("@OrderId").Direction = ParameterDirection.Output
Dim eCount As Integer
eCount = 0
myCommand.ExecuteNonQuery()
eCount = CInt(myCommand.Parameters("@OrderId").Value)
TextBox4.Text = eCount.ToString
=========================================================================
===== I used stored procedure here =============
=================================================
'Dim cmdAuthor As New SqlCommand("proc_getID", MySqlConn)
'cmdAuthor.CommandType = CommandType.StoredProcedure
'cmdAuthor.Parameters.Add(New SqlParameter("@OrderId", SqlDbType.Int))
'cmdAuthor.Parameters.Add(New SqlParameter("@CustomerName", SqlDbType.VarChar, 50))
'cmdAuthor.Parameters("@CustomerName").Direction = ParameterDirection.Input
'cmdAuthor.Parameters("@CustomerName").Value = "steve"
'cmdAuthor.Parameters("@OrderId").Direction = ParameterDirection.Output
'Dim eCount As Integer
'eCount = 0
'cmdAuthor.ExecuteNonQuery()
''eCount = CInt(cmdAuthor.Parameters("@OrderId").Value)
'If cmdAuthor.Parameters("@OrderId").Value Is DBNull.Value Then
' '' The stored procedure returned a NULL output parameter
' eCount = -12345
' TextBox4.Text = eCount.ToString()
'Else
' eCount = cmdAuthor.Parameters("@OrderId").Value
' TextBox4.Text = eCount.ToString()
'End If
'TextBox4.Text = eCount.ToString()
MySqlConn.Close()
End Sub
|
|
|
|