|
Run the exe aspnet_regiis with -i switch.
aspnet_regiis will available in the path
C:\Winnt\Microsoft.NET\Framework\[version]\
if you installed your os in the C drive.
|
|
|
|
|
On my datagrid I want to display only one record at a time instead of
four at a time.How do I navigate the grid to make the changes?I only want
one per page.
Thank You for Your Help.
Matt
|
|
|
|
|
You can use paging just set the page size to 1. Then add a pageIndexChanged event to the datagrid to handle the backwards/forward navigation.
|
|
|
|
|
There is one big problem it is a datalist.
|
|
|
|
|
I tried egghead.
Not much help.
I am trying to bind the records from the table to a datalist control in C#
private DataSet BindTBCOMMANDTYPE()
{
OdbcConnection myConnection = new OdbcConnection("DSN=POS;UID=system;PWD=system");
// Populate the ddlDataSet1
myConnection.Open();
const string strSQLDDL = @"SELECT DT_REF, DT_DESCRIPTION FROM TBCOMMANDTYPE ORDER BY DT_REF";
OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
ddlDataSet1.Clear();
myDataAdapter.Fill(ddlDataSet1, "ddlDATATYPE");
DataSet1.DataSource = ddlDataSet1;
DataSet1.DataBind();
myDataAdapter.Dispose();
myDataAdapter = null;
myConnection.Close();
return ddlDataSet1;
}
Just need the correct syntax.
http://www.eggheadcafe.com/forums/ForumPost.asp?ID=14586&INTID=6
Let's share our knowledge together!!!
mcupryk@sun.net.bb
Matt Cupryk
514-685-0449
|
|
|
|
|
You might want to try posting this in the C# Forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am experimenting with MSAgent. (Text to speech)
What I am trying to accomplish is to let the program run until the Esc key is pressed.
The code below works fine in the Visual Basic 6.0 IDE.
However, if you minimize the IDE or compile, the program still runs but pressing the Esc key does nothing.
It's like the program has lost focus.
It works fine in the IDE with no interuption.
Can someone help with this?
Here is the code:
Option Explicit
Public MyAgent As Object
_________________________________
Private Sub Form_KeyPress(keyascii As Integer)
'KeyPreview on the Forms properties window is set to True.
'Press the Esc key to exit.
If keyascii = 27 Then
Unload Me
End
End If
End Sub
__________________________________
Public Sub Delay(Seconds As Long)
Dim n As Double
n = Timer + Seconds
Do While Timer < n
DoEvents
Loop
End Sub
__________________________________
Private Sub Form_Load()
Dim Ap As String
'Set Application Path
Ap = App.Path
If Right(Ap, 1) <> "\" Then Ap = Ap + "\"
'Load the character
Agent1.Characters.Load "merlin", Ap + "merlin.acs"
Set MyAgent = Agent1.Characters("merlin")
'something wrong here
Dim keyascii As Integer
Do Until keyascii = 27
If keyascii = 27 Then End
MyAgent.Show
MyAgent.MoveTo 250, 325
Delay 2
MyAgent.MoveTo 400, 325
Delay 2
Loop
End Sub
|
|
|
|
|
If you applications Form loses the focus AT ALL, pressing ESC won't do anything because the keypress went to some other app. It's not so much a problem of minimizing the IDE as it's a question of which window got the focus after you minimized the IDE.
Make sure you click in the Window of your application before you hit ESC. Otherwise, your application will never see the ESC key being pressed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for looking Dave.
My problem is that I have no form to click on because of its transparency.
I need to make sure the form doesn't lose focus, but not sure how.
Any ideas?
|
|
|
|
|
It sounds like what you need to do is hook the keyboard instead of depending on KeyDown. If your form is transparent, it suggests that your still using other applications and giving your app things to say from other app. You're application can keep the focus, but in a multitasking operating system, that makes your app quite a p-i-t-a to use.
Check into Application.AddMessageFilter for the .NET way of hooking the keyboard. You can then see all the keyboard messages generated by the keyboard driver, look for your ESC key SYSTEM WIDE, not just the app with the focus.
I'm out of time for today, so I can't get into specifics right now, but I'll be able to do so next week.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the info Dave.
Is there a snippet available for download some place in regards to
Application.AddMessageFilter?
|
|
|
|
|
|
Thanks Dave,
I have found another way also, however, I need a timer event for it to work:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Dim k As Long
For k = 0 To 255
GetAsyncKeyState k
Next
End Sub
Private Sub Timer1_Timer()
Dim k As Long
For k = 0 To 255
If GetAsyncKeyState(27) Then End
Exit For
Next
End Sub
|
|
|
|
|
Works, but you don't need the loops in the code at all. You just need to call GetAsyncKeyState with a parameter of 27 and then check it again with the same parameter to read that key and that key only.
Now, GetAsyncKeyState will miss keys because if another app calls GetAsyncKeyState , it will receive the keypressed signal, not your app. The status of the keyboard is not kept application specific, but rather system-wide. ANY call to GetAsyncKeyState will reset the key-pressed flag, not just calls from your app. If you call GetAsyncKeyState , then another app calls it, that app will get the message that ESC was pressed and reset the flag. Now, on the timer tick, your app calls GetAsyncKeyState again, and gues what, since the flag was reset, you'll never know that the key was pressed...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am having problem in Previewing my reports. Same Code is running fine if I dont use my main form as mdi. I will appreciat if someone can help me I search all over the net but couldnt find anything like this. I have my main form as mdi , from menu I am running a form then In form I have a button for preview the report , the preview window is coming up the and error is popping up "An unhandled exception has occurred .... Object reference not set to an instance of an object.
In details: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.PrintPreviewControl.CalculatePageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
My code is very simple
Dim dlg As New PrintPreviewDialog
dlg.Document = mDoc
dlg.WindowState = FormWindowState.Maximized
dlg.ShowDialog()
If I use a non mdi form as main form in my application everything becomes fine without any modification.
|
|
|
|
|
|
I need some help getting started. I need to connect a switch to a com port and in my code trigger an event when the switch state changes. Not to difficult but what pins do I use on the port and how do I insure I will not be hurting the pc. Thanks for your input.
Mike
|
|
|
|
|
The parallel port would be a much better choice for this. You can start by checking out the enormous list of resources at Lakeview Research[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a section of code (shown below) which reads an XML file into a Dataset. The XML file looks like this:
- <NewDataSet>
- <Employees>
<SUPR>Jane Moneypenny</SUPR>
<DEPT>Accounting</DEPT>
<EMP>James Bond</EMP>
<TITL>Accountant</TITL>
<DEADL>11/15/04</DEADL>
<HOURS>24.00</HOURS>
</Employees>
</NewDataSet>
The following code produces a crystal report which I export to a pdf file. Only one row of data is per page. Basically it is a letter that goes to the supervisor per page. My client has asked if I can split the document up where it breaks into individual pdf documents per row or maybe even per supervisor. If it breaks per supervisor, the pdf file may contain multiple employees with a page per employee.
I'm new to VB.NET and not sure how to accomplish this. I've spent two days trying to come up with a for next loop that might work without luck. I'm an old COBOL programmer still trying to get familiar with object oriented programming.
Does anyone have suggestions and/or some sample code to help figure out this task.
I appreciate any help!!
Private Sub step3()
Dim ds As New DataSet
Dim fs As New System.IO.FileStream("c:\test.xml", System.IO.FileMode.Open)
ds.ReadXml(fs)
ds.Tables(0).TableName = "Employees"
Dim xmlReport As New rptRenewalReminder 'Crystal Report
xmlReport.SetDataSource(ds)
Dim frmCrystal As New frmCrystalViewer
frmCrystal.CrystalViewer.ReportSource = xmlReport
frmCrystal.ShowDialog()
Dim myDiskFileDestinationOptions As New DiskFileDestinationOptions
Dim strAdobeRenewalLetter As String
strAdobeRenewalLetter = "test.pdf"
myDiskFileDestinationOptions.DiskFileName = strAdobeRenewalLetter
With xmlReport.ExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
xmlReport.Export()
MsgBox(strAdobeRenewalLetter & " has been saved")
End Sub
<b><i><font color="blue">Lost in the vast sea of .NET</font></i></b>
|
|
|
|
|
how can i link a sub report in the main report and pass data to both reports through dataset.Thanx in advance
|
|
|
|
|
i want to add a txt file to sql db using vb6.0 how i can do it
i used this code but failed why
CODE...............--->
Option Explicit
Dim mfso As New FileSystemObject
Dim fPath As File
Private machinename As String
Public Cmd As New ADODB.Command
Public CN As New ADODB.Connection
Public RS As New ADODB.Recordset
Private Sub Command4_Click()
Dim filePath, txtFilePath, test As String
Dim i, result As Integer
i = List1.ListIndex
Dim jj As String
Dim strContent As String
Dim txtmachinename, tableName As String
machinename = String(50, " ")
Call MachineSpecificInfo.GetComputerName(machinename, Len(machinename))
txtmachinename = Left(machinename, InStr(Trim(machinename), Chr(0)) - 1)
machinename = vbNullString
On Error Resume Next
CN.ConnectionString = "Provider='" & "SQLOLEDB.1" & "' ;User id='" & "sa" & "' ;password='" & "" & "' ;Persist Security info='" & "false" & "' ; Data Source='" & txtmachinename & "' ;Connect Timeout=0; Initial Catalog='" & "darpg" & "'"
CN.Open
RS.CursorType = adOpenDynamic
RS.LockType = adLockOptimistic
RS.CursorLocation = adUseClient
tableName = "pdbftsdata"
RS.Open "Select max(FTSIndex) from pdbftsdata", CN
Dim maxx As Integer
maxx = RS(0)
maxx = maxx + 1
result = InStr(1, List1.List(i), "_")
DocId = Left$(List1.List(i), result - 1)
DocId = 13
MsgBox DocId
'Set fPath = mfso.GetFile(txtFilePath)
Set fPath = mfso.GetFile("C:\Documents and Settings\mdabaan\Desktop\Last Project\TXTFolder\a.txt")
Set objTextStream = fPath.OpenAsTextStream(ForReading)
strContent = objTextStream.ReadAll
'result = Len(strContent)
Dim textShow As String
MsgBox strContent
textShow = Replace(strContent, vbCrLf, " ")
objTextStream.Close
MsgBox textShow
Dim ss As String
ss = textShow
RichTextBox1.Text = ss
MsgBox Len(ss)
CN.Execute "INSERT INTO pdbftsdata(Documentindex,data) values('" & DocId & "','" & ss & "')"
CN.Close
'------------
List1.RemoveItem (i)
'List2.RemoveItem (i)
' End If
'End If
End Sub
Thanks alot
Metal Man
|
|
|
|
|
hi, i wrote a code that open a txt file and then add it to sql db but nothing added i will put my code to see could any1 help me ASAP to solve my problem cause no thing added why??????
Code---->>>>
Option Explicit
Dim mfso As New FileSystemObject
Dim fPath As File
Private machinename As String
Public Cmd As New ADODB.Command
Public CN As New ADODB.Connection
Public RS As New ADODB.Recordset
Private Sub Command4_Click()
Dim filePath, txtFilePath, test As String
Dim i, result As Integer
i = List1.ListIndex
Dim jj As String
Dim strContent As String
Dim txtmachinename, tableName As String
machinename = String(50, " ")
Call MachineSpecificInfo.GetComputerName(machinename, Len(machinename))
txtmachinename = Left(machinename, InStr(Trim(machinename), Chr(0)) - 1)
machinename = vbNullString
On Error Resume Next
CN.ConnectionString = "Provider='" & "SQLOLEDB.1" & "' ;User id='" & "sa" & "' ;password='" & "" & "' ;Persist Security info='" & "false" & "' ; Data Source='" & txtmachinename & "' ;Connect Timeout=0; Initial Catalog='" & "darpg" & "'"
CN.Open
RS.CursorType = adOpenDynamic
RS.LockType = adLockOptimistic
RS.CursorLocation = adUseClient
tableName = "pdbftsdata"
RS.Open "Select max(FTSIndex) from pdbftsdata", CN
Dim maxx As Integer
maxx = RS(0)
maxx = maxx + 1
result = InStr(1, List1.List(i), "_")
DocId = Left$(List1.List(i), result - 1)
DocId = 13
MsgBox DocId
'Set fPath = mfso.GetFile(txtFilePath)
Set fPath = mfso.GetFile("C:\Documents and Settings\mdabaan\Desktop\Last Project\TXTFolder\a.txt")
Set objTextStream = fPath.OpenAsTextStream(ForReading)
strContent = objTextStream.ReadAll
'result = Len(strContent)
Dim textShow As String
MsgBox strContent
textShow = Replace(strContent, vbCrLf, " ")
objTextStream.Close
MsgBox textShow
Dim ss As String
ss = textShow
RichTextBox1.Text = ss
MsgBox Len(ss)
CN.Execute "INSERT INTO pdbftsdata(Documentindex,data) values('" & DocId & "','" & ss & "')"
CN.Close
'------------
List1.RemoveItem (i)
'List2.RemoveItem (i)
' End If
'End If
End Sub
Thanks alot
Metal Man
|
|
|
|
|
I'm not even ogin to attempt to compile this. We've said it here on the board dozens of times.
NEVER use string concantenation to put together an SQL statement! There is absolutely no reason to do it.
Now, the reason your SQL is failing is probably because there is an ' character in your text file. That's all that is required to destroy your SQL statement.
The fix will be to use parameterized queries. This is virtually the only method you can use to guarantee that the contents of the text file will get processed properly and not screw up your SQL statement.
See Calling a Stored Procedure with a Command[^] on MSDN for an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi man thanks for ur time, but i have another solution which is i will replace all the enter in the txt file to space cause db doesnt accept ok, now i will split the txt to sparate lines depend on ' charachter if t appear, ok so i will first add a apce to the field then i will update it, i used the command---->
CN.Execute "UPDATE pdbftsdata SET Data = '" & strToAdd & "' Where = DocumentIndex= 13"
but it doesnt executed could u tell me why, and whats th coorect update line have to be, thanks alot
Thanks alot
Metal Man
|
|
|
|
|
hi man again, i replaced all the ' character with a special char, and then added all the txt file it was added correctly, i want to make a procedure that will replace all the ' char in this field and return it to ' char how i can do it
Thanks alot
Metal Man
|
|
|
|
|