|
Cross posting[^] is considered rude.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
i dont know
poda fool
|
|
|
|
|
hi,
This code will export the datalist into Excel with exact text,position and style in asp.net.
Please include System.IO at the top of the file.
string filename = "BacklogData.xls";
Response.Cache.SetExpires(DateTime.Now.AddSeconds(1));
Response.ContentType = "application/vnd.ms-excel";
Response.ContentEncoding = Encoding.Unicode;
Response.BinaryWrite(Encoding.Unicode.GetPreamble());
Response.Charset = "";
this.EnableViewState = false;
Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
Response.Write("\r\n");
Response.Write("<style> .text " + "\r\n" + " {mso-style-parent:style0;mso-number-format:\""+@"\@"+"\""+";} " + "\r\n" + "</style>");
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
DataList.RenderControl(hw);
Response.AppendHeader("content-disposition","attachment;filename="+filename);
Response.Write(tw.ToString());
Response.End();
Happy Coding !!!!
Regards
Arun Kumar
H
|
|
|
|
|
this will not work it will give you error like while working with master page
'ctl00_CntFormContents_DataList1_ctl01_gvTopFiveMasterIntroducer' of type 'GridView' must be placed inside a form tag with runat=server'
any suggetion
|
|
|
|
|
Thank you so much. Your code help me. Wish you happy for whole your life.
|
|
|
|
|
Hi,
I have a windows (System.Windows.Window) that shows a question for the user. This window is not opened by the GUI thread. I want this window to always be on top, how can I do this?
Regards
Marc
|
|
|
|
|
Hi,
have you tried Form.TopMost ?
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.
|
|
|
|
|
|
Hello there!
My code is highlighted below.I have five tabpages(two is shown here!) on a form called vwpatient that runs each time a tabpage is selected.The code below works but my problem is this: there is a textbox called sachPatient.patID from another form called sachPatient, the code pulls data from the database on clicking one or two pages, but if more than two is clicked, an exception fires saying "Make sure you have not released a resource before attempting to use it". I have tried endlessly to fix this problem to no avail. And am still trying!!.
I would appreciate if someone can help me.
Thanks in advance!!!
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
For Each tabcont As Control In Me.Controls
If TypeOf tabcont Is TabControl Then
For Each tp As Control In tabcont.Controls
If TypeOf tp Is TabPage Then
Select Case tp.Name
Case "vwProfTabPg"
Try
LoadData()
' Configure and execute the command.
cmd = New System.Data.SqlClient.SqlCommand("SELECT * FROM Patient_profile where patient_Id = @Pat_ID")
cmd.Connection = cn
Dim paraPatId As SqlParameter = cmd.Parameters.Add("@Pat_ID", sachPatient.patID.Text)
' Load the DataTable.
datadapt = New System.Data.SqlClient.SqlDataAdapter(cmd)
datadapt.Fill(ds)
ds.Tables.Add(dt)
' Bind the DataGrid.
vwProfDG.DataSource = ds.Tables(0)
vwProfDG.Visible = True
Catch ex As SqlException
MsgBox(ex.Message.ToString())
Finally
cn.Close()
End Try
Case "vwLabTabPg"
Try
LoadData()
' Configure and execute the command.
cmd = New System.Data.SqlClient.SqlCommand("SELECT * FROM lab where patient_Id = @PatLa_ID")
cmd.Connection = cn
Dim paraPatId As SqlParameter = cmd.Parameters.Add("@PatLa_ID", sachPatient.patID.Text)
' Load the DataTable.
datadapt = New System.Data.SqlClient.SqlDataAdapter(cmd)
datadapt.Fill(ds)
ds.Tables.Add(dt)
' Bind the DataGrid.
vwLabDatGrid.DataSource = ds.Tables(0)
vwLabDatGrid.Visible = True
Catch ex As SqlException
MsgBox(ex.Message.ToString())
Finally
cn.Close()
End Try
End Select
End If
Next
End If
Next
|
|
|
|
|
First of all, you can replace the loop through the TabPages at the start with a simple TabControl1.SelectedTab.Name and do a Select Case on that. Second, please post your code in <pre> tags. Lastly, which line does the error occur on?
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Thanks a lot Computafreak for ur help.
Here is still the problem:
My code is highlighted below.I have five tabpages(two is shown here!) on a form called vwpatient that runs each time a tabpage is selected.The code below works but my problem is this: there is a textbox called sachPatient.patID from another form called sachPatient, the code pulls data from the database on clicking one or two pages, but if more than two is clicked, an exception fires saying "Make sure you have not released a resource before attempting to use it". I have tried endlessly to fix this problem to no avail. And am still trying!!.
I would appreciate if someone can help me.
Thanks in advance!!!
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Select Case tabControl1.SelectedIndex
Case 0
Try
LoadData()
' Configure and execute the command.
cmd = New System.Data.SqlClient.SqlCommand("SELECT * FROM Patient_profile where patient_Id = @Pat_ID")
cmd.Connection = cn
Dim paraPatId As SqlParameter = cmd.Parameters.Add("@Pat_ID", sachPatient.patID.Text)
' Load the DataTable.
datadapt = New System.Data.SqlClient.SqlDataAdapter(cmd)
datadapt.Fill(ds)
ds.Tables.Add(dt)
' Bind the DataGrid.
vwProfDG.DataSource = ds.Tables(0)
vwProfDG.Visible = True
Catch ex As SqlException
MsgBox(ex.Message.ToString())
Finally
cn.Close()
End Try
Case 1
Try
LoadData()
' Configure and execute the command.
cmd = New System.Data.SqlClient.SqlCommand("SELECT * FROM lab where patient_Id = @PatLa_ID")
cmd.Connection = cn
Dim paraPatId As SqlParameter = cmd.Parameters.Add("@PatLa_ID", sachPatient.patID.Text)
' Load the DataTable.
datadapt = New System.Data.SqlClient.SqlDataAdapter(cmd)
datadapt.Fill(ds)
ds.Tables.Add(dt)
' Bind the DataGrid.
vwLabDatGrid.DataSource = ds.Tables(0)
vwLabDatGrid.Visible = True
Catch ex As SqlException
MsgBox(ex.Message.ToString())
Finally
cn.Close()
End Try
End Select
|
|
|
|
|
Hi,
if
(1) you watch all the exception information using Exception.ToString()
(2) you told your IDE to always show line numbers in edit windows
then it is easy to figure out which line causes the problem.
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.
|
|
|
|
|
post by Luc Pattyn:
2) you told your IDE to always show line numbers in edit windows
how do i do that?
And am sory if my codes appear naive, am not experienced in vb.net.
Thank for your help.
|
|
|
|
|
nedusmile wrote: told your IDE to always show line numbers in edit windows
how do i do that?
depends on the IDE.
On some versions of Visual Studio, it is under menu Tools/Options/TextEditor/AllLanguages: display line numbers.
nedusmile wrote: sory if my codes appear naive
I'm not making such comment, I try to make you help yourself in the first place. Code quality comes with dedication and experience.
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.
|
|
|
|
|
Somewhere in this mess you've released a resource (i.e. Disposed of it) - my guess would be that it's the connection that's causing you problems.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Don't post VB trash outside the VB forums and then vote down someone like Pete when he provides you with freely given advice.
|
|
|
|
|
Hi,
I have developed a code to create a ms-access table through VB.NET as mentioned below.
ADOXtable = New ADOX.Table
ADOXtable.Name = "ACN_CHARX_INSTANCE"
ADOXtable.Columns.Append("LOGICAL_DB_NAME", ADOX.DataTypeEnum.adVarWChar, 32)
ADOXtable.Columns.Append("DIM_NAME", ADOX.DataTypeEnum.adVarWChar, 32)
ADOXtable.Columns.Append("CHARX_NAME", ADOX.DataTypeEnum.adVarWChar, 128)
ADOXtable.Columns.Append("CHARX_TABLE", ADOX.DataTypeEnum.adVarWChar, 128)
ADOXtable.Columns.Append("CHARX_VALUE_COL", ADOX.DataTypeEnum.adVarWChar, 128)
ADOXtable.Columns.Append("VALUES_UNIQUE", ADOX.DataTypeEnum.adInteger)
ADOXtable.Columns.Append("CHARX_ORDER_COL", ADOX.DataTypeEnum.adVarWChar, 128)
ADOXtable.Columns.Append("CHARX_ORDER", ADOX.DataTypeEnum.adInteger)
ADOXtable.Columns.Append("CHARX_NUMERIC_COL", ADOX.DataTypeEnum.adVarWChar, 128)
ADOXtable.Columns.Append("BITMAP_COL", ADOX.DataTypeEnum.adVarWChar, 128)
cat.Tables.Append(ADOXtable)
Now i want to set primary key constraints for this table through coding. Please share your ideas...
Thanks,
Sivakumar.M.
|
|
|
|
|
|
Hi,
How many primary key constraints can we have in a table of ms-access? Any other constraints available in ms-access other than primary key?
Please share your ideas...
Thanks,
Sivakumar.M.
|
|
|
|
|
This question has nothing to do with .NET. Please ask in the Database forum.
|
|
|
|
|
For all its in the wrong forum.....
How many primary key constraints can you have in any database table? That'll be one, although the primary key can be made up multiple columns.
|
|
|
|
|
Hi everyone,
Now I have a Crystal Report file, and I print this file with Epson T88IV. But it prints so slowly.
When I type a Print Command in Commandline of Windows to print a Text File, It prints immediately. But It can print Unicode Text. It prints ASSCII only.
My print command
Print D:\temp.txt /d:com1
Can I print a Crystal Report File immediately? How Do I Do?
Thanks so much.
modified on Thursday, June 18, 2009 1:25 AM
|
|
|
|
|
Practically speaking you cannot print the crystal report in ASCII format.
The system sent the output to the printer in form of Image.
But when you send the same request from DOS prompt, the data is send as ASCII
|
|
|
|
|
Thanks for you reply.
Can you show me How Do I print it with UniCode font so Quickly?
I know when I use a print dialog in another software, firstly It converts my text to image and then the printer work.
If I convert Text to image then I Print a image file. Does it print immediately?
Thanks.
|
|
|
|
|
We solved this problem once. But we were not using the Crystal report
But you can give the try
We used a grid control.. format it and then send it to the printer.
We never submit the document to the normal printer. But try to install 9-Pin IBM printer, set it as default printer and submit the document to this printer.
Any how this solved our problem
|
|
|
|