|
*grin*
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Can we create a 3D project in VB.Net?
If we can, please express me any project or some codes...
thank you 
|
|
|
|
|
phowarso wrote: Can we create a 3D project in VB.Net?
If you mean what I think you mean, then yes.
phowarso wrote: If we can, please express me any project or some codes...
Please express me $10,000
Is Bing broken where you are?
thank you
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Direct X
If everything was not true, would it be not true that everything is not true?
<font color="red">"Assembly.<br /> Ah, yes that dreaded thing that pulled itself out of the abyss. <br />-- Wait, assembly is not that bad. It just takes time to adjust to."</font>
|
|
|
|
|
hi all,
i want to list out all the instance of SQL server. i use following code for this purpose
Dim instance As System.Data.Sql.SqlDataSourceEnumerator = System.Data.Sql.SqlDataSourceEnumerator.Instance()<br />
Dim table1 As System.Data.DataTable = instance.GetDataSources()<br />
For Each row As DataRow In table1.Rows<br />
<br />
If cboServer.Items.Contains(row.Item(0).ToString) Then<br />
Else<br />
cboServer.Items.Add(row.Item(0).ToString)<br />
End If<br />
Next
but some time above code does not enumerate all the instance of sql server on local network.
so i want to ask whether there are any method which enumerate all the instance of sql server which is located on my local network
|
|
|
|
|
I use SmoApplication.EnumAvailableSqlServers()[^], which seems to work reliably for me.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello,
I have to read an Excel file, update some data and save the file. I wrote small code to open, read, save and close an excel file. I am using Microsoft.Office.Interop to achieve the goal. I have set the Excel application visibility as false. I tried the same in C# and VB.NET, but am facing same problem. Code is below:-
Private Sub OpenFile()
Try
excelApp = New Excel.ApplicationClass()
excelApp.Visible = False
excelworkbook = excelApp.Workbooks.Open(workbookPath, 0, False, 5, "", "", False, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", True, False, 0, False, False, False)
excelSheets = excelworkbook.Worksheets
excelWorkSheet = excelworkbook.Worksheets("Sheet1")
MessageBox.Show("Connected and Opened")
range = excelWorkSheet.UsedRange
MsgBox("Rows = " + range.Rows.Count.ToString + " Cols = " + range.Columns.Count.ToString)
Catch e As Exception
excelSheets = Nothing
excelworkbook = Nothing
excelWorkSheet = Nothing
excelApp = Nothing
MessageBox.Show("Exception MSG " + e.Message + "\n ST :" + e.StackTrace)
End Try
End Sub
Private Function ReadRow(ByVal rowNo As Integer, ByVal startRange As String, ByVal endRange As String) As Array
Dim rge As Excel.Range = Nothing
Dim valuesList As Array = Nothing
Try
rge = excelWorkSheet.Range(startRange, endRange)
valuesList = rge.Cells.Value
Catch e As Exception
MsgBox("Uable To Read from " + startRange + " To " + endRange + " Due to " + vbCrLf + e.StackTrace)
Save_Close()
End Try
Return valuesList
End Function
Private Sub Save_Close()
Try
excelworkbook.Save()
excelworkbook.Close()
Catch ee As Exception
MessageBox.Show("Unable To Save : " + ee.Message)
excelworkbook.Close()
End Try
releaseObject(excelApp)
releaseObject(excelworkbook)
releaseObject(excelWorkSheet)
releaseObject(excelSheets)
MessageBox.Show("File Closed")
End Sub
Private Sub releaseObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
Finally
GC.Collect()
End Try
End Sub
Methods I have called is :
OpenFile()
ReadRow(1, A1, AL)
Save_Close
The problem I am facing is:
For REad Row: I get Exception
Unable to Read from A1 to AL Due to
Exception from HRESULT : 0X800A03EC
st: AT ....WorkSheet.getRange(Object Cell1, Object Cell2) at ....Line no
I tried the same code with ReadRow parameters as 1, A1, I6) and I got an array successfully. I want to read contents of a row of the provided range.
On calling excelworkbook.Save() in Save_Close(), I get exception as follows and the system halts/hangs on close line. I have to Stop Debugging.
Unable to save: Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
After once executing, the next time I run the application, I get on start, "File is being used by , want to open as read-only?" with Yes/No options.
Can anybody help me know where am I going wrong. The file is .xls file with fixed 1st 3 cols and has several cols till CL or even more. My OS is Vista. I have added reference of Microsoft.Office.Interop.Excel version 12. I tried with 11 also, but faced same error. I want to edit the file also, so it should be opened with ability to update and not just Read-Only.
Any help is appreciated. Please try to help at the earliest. I am in big trouble.
Thanks
Terry
|
|
|
|
|
I have a DateTimePicker where the user picks a date and this date is then written to a sql database. I store this date in variable before using it in the update sql string. The problem is that it interprets a date like 3 Jul 2009, as 7 Mar 2009. My regional settings is set as English (South Africa), short date is dd/mm/yyyy.
Can I change the DateTimePicker to use the date format that I want?
I even tried changing the DateTimePicker format to 03 Jul 2009 but when I step through the code I see the value as #7/3/2009 3:02:39 PM#.
I am using VB.net express on a XP machine.
Any help is much appreciated.
|
|
|
|
|
Are you by any chance running the over multiple machines?
The format of that date must be in the databases format, ignore any local settings.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
No, I am still testing - only on my machine. How can I get the format that the DateTimePicker gives me (mm/dd/yyyy) to the format the database uses (dd/mm/yyyy)?
|
|
|
|
|
You can set custom format for date picker (but i don't see problem with date variable filling sql parameter and wrting it in database, format is not important).
click on date picker, set "format" to custom (on properties window) and under "custom format" set standard vb date format, MM/dd/yyyy.
Edit: please use sql parameters, it will make your life so much easier. You don't have to worry about date formats, decimal number seperator, etc...
Edit2: date picker should automatically take your default cultrue info and use format specified in it, so i'm not sure why he would show you different date format than the one specified at your os. Also, if you want to receive short date format, under "format" property set to "Short".
Before developing always get to know components you will be using.
|
|
|
|
|
Here is what I do:
Select a date from the DateTimePicker (3 Jul 2009)
In my Code I have:
Dim VisitDate as Date
VisitDate = DateTimePicker.Value
When I view VisitDate in the debugger it shows #7/3/2009 ....#
I then use VisitDate in my SQL string and the database sees it as 7 March, not 3 Jul.
I'm new to programming - will google sql parameters and see what I get.
|
|
|
|
|
i guess you are doing something like:
Dim VisitDate as Date
VisitDate = DateTimePicker.Value
"INSERT INTO Table (VisitDate) VALUES ('" & VisitDate & "')"
which looks like this then:
"INSERT INTO Table (VisitDate) VALUES ('7/3/2009')"
SQL parameters will fix this, and as a beginner, you should start using them, it's best way to work with sql server.
Btw, only way you can make sure sql server (set up on any pc, no matter if it's set up as usa, english, spanish, german, etc... format) is to format date to "yyyyMMdd". SQL server will always know that first 4 is year, second 2 is month, and third 2 is day. And in your code you would have to do something like this:
"INSERT INTO Table (VisitDate) VALUES ('" & VisitDate.ToString("yyyyMMdd") & "')"
|
|
|
|
|
Yes, that is exactly what I am doing. It seems I have to look into SQL parameters to get this problem sorted.
Thanks to all for their replies!
|
|
|
|
|
OK, I changed my code to use sql parameters and it works perfect (I get the right date into my database, no matter what format I use in the datetimepicker).
I just have one more question on this date issue. I want to pass the date part only of the datetimepicker, excluding the time. I see in other tables where a date is used and the time is not relevant, the time is set to 12:00:00 AM
Is there an easy way to do this?
|
|
|
|
|
Hi
I need some help with webqueries.
I'm trying to create a routine to ask web queries and to enter them into the current Excel cell.
I have programmed a Excel 2003 Com Addin. This is the code I receive, during Macro recording within Excel 2003 and below is the code for the VB .net Com Addin, which throws an error message.
<pre>Sub Makro1()
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://..." _
, Destination:=Range("A1"))
.Name = _
"foobar"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Now the equivalent code which throws an 0x800A03EC Error
<pre>Try
Dim currentApplication As Microsoft.Office.Interop.Excel._Application = Globals.ThisAddIn.Application
With currentApplication.ActiveSheet.QueryTables.Add(Connection:="URL;http://..." _
, Destination:=currentApplication.Range("A1")) '.ActiveCell) 'currentApplication.Range("A1"))
.Name = "foobar"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = Excel.XlCellInsertionMode.xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = Excel.XlWebSelectionType.xlAllTables
.WebFormatting = Excel.XlWebFormatting.xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
'.Refresh(BackgroundQuery:=False)
End With
Marshal.ReleaseComObject(currentApplication)
currentApplication = Nothing
Catch ex As Exception
Debug.Write(ex.ToString)
'MsgBox("Insert into cell not possible")
End Try
End If
End Sub
The error Message is
<pre>An Exception (First Chance??) of the type "System.Runtime.InteropServices.COMException" within
Microsoft.VisualBasic.dll is thrown.
System.Runtime.InteropServices.COMException (0x800A03EC):
The webquery is invalid
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[]
args, String[] paramnames, Boolean[] CopyBack)
within Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String
MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
Can anyone help me?
Thanks
|
|
|
|
|
Hello,
I have the a DataTable and I want to show it in Report, For this I do this...
1. Create a DataTable "tbl" and add data into it.
2. Create a DataSet1 (DataSet1.xsd) having table ("tblEmp") with same defination as in my DataTable "tbl"
3. In a Form Draw ReportViewer1 control and a button(Button1) and create following code in
Button1_click event
Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
Me.ReportViewer1.LocalReport.ReportPath = "C:\Report1.rdlc"
Me.ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("tblEmp", tbl))
Me.ReportViewer1.RefreshReport()
The report show only report columns without any data. [My tbl has 3 rows]
Please tell me where I am wrong ?
Thanks
|
|
|
|
|
Dear,
You solve this problem.
I have the same problem.
If you solve this one.
Please help me
|
|
|
|
|
Experts,
I am stucking and need your help/hints.
Situation:
My application runs on a locked PC and should unlock the PC by request. Thats all!
"Locked" means here that the user pressed "Ctrl-Alt-Del" and then the "Lock Computer" button.
Means the user sees now the "Windows login screen" on his screen.
Operation System: XP only - for now
Details:
My application runs and listens on the blocked PC for commands.
One command is the "unlock the PC!".
The command contains also the username, password and the domain of that user that is currently logged in.
The PC should be unlocked for him!
What I not want:
I want no code for receiving messages - that works already fine in my application.
I want not to switch the user!
I want not that my application runs another application under this or that rights/user.
I want not the auto login (after next reboot).
I want also not to find the "Windows login screen" over his name, and sending the user and password via
sendmessage... (Please think about a japanese PC and how the window title of the windows login screen
looks there
What I tested / found / googled:
... was always a "run as", the auto login or doesnt work (like api call "CreateProcessWithLogon" or LogonUser (advapi32))
Thank you very much in advance!
modified on Friday, July 3, 2009 4:11 AM
|
|
|
|
|
"My application runs on a locked PC and should unlock the PC by request."
Is it an application, or is a service? If it's not a service, then it's not running at all.
Btw, if one could log in to windows from some third application, which is not process at all, then i would think that there would be a bug in OS. That would enable a virus to first capture user name and password, and then login him once he goes away (?!? sounds strange) and then starts playing with just about anything on pc. Hm... what is next request, turn off his firewall?
You want to control computer os without even running os? Only few services are started when you are not loged in, and all aplications are "paused", keep that on mind. First, for you application even to be running, it needs to be service (set up to start automatically, and run under local service).
If you want to achive remote locking of cumputer, think of computer control without unloging user and loging him back in windows.
|
|
|
|
|
thx 4 ur fast reply.
Its an application.
And I still believe that the application runs, because I am not talking about the startup scenario! The user started the computer, logged in and pressed then (some times later) the Ctrl+Alt+Del keys ... as described it in my post.
So please assume that the application runs and can react on commands (which are via tcp send).
Also as descibed before: This works all fine, but I am not able to unlock the pc (with the known username, pw and domain...)
Enver, no please be sure that this will not be finally a virus, trojan etc.!
|
|
|
|
|
|
thank you very much!
Ah, ... "Gina" - I am still fighting with "WlxInitialize"
May be the other links are bringing the solution
Thanks!!
I will report here asap when i found a solution!
|
|
|
|
|
aucun is implementing WlxInitialize, this is the way it works, so i guess first step would be to take a look how aucun is doing it, but its source is in c++ 
|
|
|
|
|
I hope you do understand that "aucun" requires some actions to force windows to use aucun instead of "msgina". But if this is for your internal application which you will install on client pc, i think that should not be a problem.
|
|
|
|
|