|
100%
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
|
ik ook (*)
(*) so am I
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
hi all
i am new to .net
m using vb.net 2005
Dim cn As New SqlConnection("Server=;uid=sa;pwd=;Database=")
Dim da As New SqlDataAdapter("select Lognumm,Requestdate,Hospital from Table3 where Hospital= '" & DropDownList1.SelectedItem.Text & "' and Flag=1", cn)
Dim dt As New DataTable
da.Fill(dt)
da.Dispose()
cn.Dispose()
Me.DataGrid1.DataSource = dt
Me.DataGrid1.DataBind()
the above code is for asp.net web apllication using vb.net...now how to do i convert it to vb.net windows application.
i mean what kind of code do i need to write in windows application..
Tanya...(urs_forever_tanya@yahoo.co.in)
|
|
|
|
|
try this
Dim cn as new SqlConnection(.......)<br />
dim da as new SqlDataAdapter(......)<br />
DropDownList.SelectedItem.text & " And Flag=1",cn)<br />
Dim dt as new Datatable<br />
da.Fill(dt)<br />
'No more Dispose, remember automatic garbage collection<br />
Datagrid1.DataSource = dt <br />
remember when you use a datatable, and binding it to a datagrid, you can only use the DataSource Property.
this will do
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi All,
I am using the following code to convert the MSflexgrid content to Excel.
This code is also working fine. It opens MS Excel and paste the contents of MSFlexgrid.
But now for me, when i click the button it should ask Open, Save (or)Cancel kind of dialog box, and if press Save it should show Save dialog box and give filename and save it, or if we Give open it should open the excel sheet.
Please help me how to do that.
Code:
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Set xlApp = New Excel.Application
Set xlWB = xlApp.Workbooks.Add
Clipboard.Clear 'Clear the Clipboard
With MSFlexGrid1 'Select Full Contents (You could also select partial content)
.Col = 0 'From first column
.Row = 0 'From first Row (header)
.ColSel = .Cols - 1 'Select all columns
.RowSel = .Rows - 1 'Select all rows
Clipboard.SetText .Clip 'Send to Clipboard
End With
With xlApp.ActiveWorkbook.ActiveSheet
.Range("C2").Select 'Select Cell A1 (will paste from here, to different cells)
.Paste 'Paste clipboard contents
End With ' This makes Excel visible
xlApp.Visible = True
Thanks in Advance,
Regards
|
|
|
|
|
aaraaayen wrote: and if press Save it should show Save dialog box and give filename and save it, or if we Give open it should open the excel sheet.
Then save the data to a temporary .xls file in the %TEMP% folder and launch this .xls file so Excel launches and opens the file itself.
|
|
|
|
|
hi
I created a web service to allow my client program to talk to my website
There is a log in, on my client and website which uses the same username and password.
How would i pass data from my client to the webpage but specific to the user that logged in on the client ..
thanks
|
|
|
|
|
Web Services inherantly do not maintain any sort of state between calls, so you have to provide some method of doing so yourself. Some examples and articles on this can be found by Googling for ".net web service maintain session state[^]".
|
|
|
|
|
Can someone help me with an If statement? I have one Excel sheet with gobs of data and several sheets thereafter with pivot tables. My code will eventually sequence through the various sheets and update the PivotTables. I can't figure out the command to determine if the sheet contains (and ultimately select a cell in) a PivotTable.
TIA,
Bomb_Shell (noob)
|
|
|
|
|
AFAIK, Pivot tables are auto generated based on the data you selected for pivot in Excel. So, why are you changing the Pivot? Instead change the source data, Pivot table will automatically update itself.
"hi, I am explorer.exe. sometimes when you are doing anything at all, I will just freeze for ten minutes. All of my brother and sister windows will also freeze, because they are sad for me. Maybe we will come back, maybe not, it will be a surprise!"
|
|
|
|
|
|
That kind of helps. I was looking more for something like:
If
the active sheet has a pivot table <-- this is the part I'm stumped on.
Then
PivotCache.Refresh
Bomb_Shell (noob)
|
|
|
|
|
Hello Community,
I'm trying to write a dll that contains a abstract UserControl (Name: StepBase). I wrote two UserControls that inherits the abstract one and now when I open one of the inherited I got the following message:
The designer must create an instance of type 'StepBase' but it cannot
because the type is declared as abstract.
On the internet I found a website with a solution but it do't work. On the website the author wrotes that I have to add a custom TypeDescriptor like this:
<TypeDescriptionProvider(GetType(ConcreteClassProvider))> _<br />
Public MustInherit Class StepBase
Additional I have to add a ConctreteUserControl-Class:
Public Class ConcreteStepBase<br />
Inherits StepBase<br />
End Class
Here is the custom TypeDescriptor:
Public Class ConcreteClassProvider<br />
Inherits TypeDescriptionProvider<br />
<br />
Public Sub New()<br />
MyBase.New(TypeDescriptor.GetProvider(GetType(StepBase)))<br />
End Sub<br />
<br />
Public Overrides Function GetReflectionType(ByVal objectType As Type,<br />
ByVal instance As Object) As Type<br />
If objectType Is GetType(StepBase) Then<br />
Return GetType(ConcreteStepBase)<br />
End If<br />
Return MyBase.GetReflectionType(objectType, instance)<br />
End Function<br />
<br />
Public Overrides Function CreateInstance(ByVal provider As<br />
IServiceProvider, ByVal objectType As Type, ByVal argTypes() As Type, ByVal<br />
args() As Object) As Object<br />
If objectType Is GetType(StepBase) Then<br />
objectType = GetType(ConcreteStepBase)<br />
End If<br />
Return MyBase.CreateInstance(provider, objectType, argTypes, args)<br />
End Function<br />
End Class
I get this solution from the following website:
http://www.urbanpotato.net/default.aspx/document/2001
The provided solution does not work; I added a throw new Exception to the constructor of my custom TypeDescriptor and this Exception is not thrown, so that I think, the TypeDescriptor will not be used.
What is my fault?
Manfred
modified on Tuesday, April 1, 2008 5:08 PM
|
|
|
|
|
You did notice that you have to use Visual Studio 2005 and .NET 2.0, correct?? Also, the solution provided was developed under the beta versions of these two products, so any results you get may or may not apply to the final release versions.
Visual Studio, to this day, still does not provide support for designing abstract forms and controls. And, if you read the very bottom of the article:
Summary
While it is a bit of a drag that the Windows Forms designer doesn’t support abstract classes, by using this simple technique you can trick it into doing so. This requires at least Beta 1 of Visual Studio Whidbey. As I found when trying to use the inheritance picking dialog, there may still be pitfalls here, so before going hog wild with your own projects you should make sure this technique works for you in all the scenarios you care about. Microsoft doesn’t officially support designing abstract base classes, so as I said above, you will be on your own if something doesn't work for you.
|
|
|
|
|
Hi all,
Is there a way to force TextFieldParser to also read special characters like those used in French (ex é ç è à) . Now is all I get for those is ascii 63. I guess that it has something to do with encoding or localisation...
Thx !
Vinny
|
|
|
|
|
I suggest you have a look at TextFieldParser(Stream, Encoding) Constructor then.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Indeed !!!
Sorry for my stupid question, I'm a bit new to all this ... !
Vincent.
Vinny
|
|
|
|
|
No Problem.
Try to make friends with documentation and Google...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I am trying to save values to a text file using the VB editor embedded in to the Microsoft Office suite, more specifically using excel. I am fluent in C#, however I am new to VB and I can't seem to get the anything declared or working.
I've searched through MSDN and google, and everything i try doesn't work.
That said; Does anyone know how to create a new txt file, and write into it? (I think most of my problem is that I don't know where to declare the streamwriter).
Thanks in advance
Adam
--Its not broken if it never worked.
|
|
|
|
|
I'm not sure what version of Visual Basic Microsoft Office comes with, but in .Net you declare the streamwriter inside of your method (Sub , Function , etc).
<br />
Dim sW As IO.StreamWriter = New IO.StreamWriter(pathtToFile)<br />
sW.Write(Data)<br />
sW.Close()<br />
sW.Dispose()<br />
I hope this helps.
|
|
|
|
|
I'll try it again, but last time I tried that it threw an error at the '=' and said it expected an end of statement.As for what version I am using I am not 100% sure, its the built in editor to Microsoft Office 2003.
I'll try this in the morning and pop back on here if i still can't get it working.
Thanks a bunch for the response!
--Its not broken if it never worked.
|
|
|
|
|
You're welcome. If that doesn't work, you could also try,
Dim sW As New IO.StreamWriter(pathToFile)
or
<br />
Dim sW As IO.StreamWriter <br />
sW = New IO.StreamWriter(pathToFile)<br />
I hope this helps; I haven't used the programming tools included with Office for a couple of years.
modified on Tuesday, April 1, 2008 8:47 PM
|
|
|
|
|
Hey,
I tried what you posted there and got the following error.
--Compile error:
--Expected end of statement
It happened at the first bracket of this line.
sW = New IO.StreamWriter(pathToFile)
If this were C# I would assume I hadn't included the right system file, but i can't seem to declare a system file, ie:
using System.IO
Do you know if that is the case with VB, and if so do you know the syntax for including it?
--Its not broken if it never worked.
|
|
|
|
|
Adam.m.Nelson wrote: I'll try it again, but last time I tried that it threw an error at the '=' and said it expected an end of statement.As for what version I am using I am not 100% sure, its the built in editor to Microsoft Office 2003.
AFAIK, Office 2003 uses VBA for the scripting - it probably doesn't recognise StreamWriter.
|
|
|
|