|
I forgot how to do this and I am not exactly sure how to search for it. But I am displaying 2 texts in the same label but I want them to be on different lines. I have seen it before but I have forgotten how to do it can someone please help me!
Thank You!
|
|
|
|
|
use "\n" inside a string or look at the example below:
label1.Text = "foo" & System.Environment.NewLine & "second line"
|
|
|
|
|
I am trying to connect to the database through Microsoft by doing new project and selecting database but does not seem to be working, this is a new venture for me and i have an assignment that says i must do a database with oracle consisting of 3 or 4 tables and by use of VB.Net retrieve the information from the oracle database.
Thank You Beforehand
Kendo
|
|
|
|
|
Which part is not working ? Do you have Oracle running ? Do you know how to connect to SQL Server and the issue is Oracle ? There are Oracle specific classes in .NET, have you looked at the help for them ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i am reading up online at present and have been for the last 4 days but i just dont understand at present. Last year i created a database with access with front end VB.NET. Theatre booking system.
But i have never used oracle before and i just keep reading up online from oracle site but just keep bashing my head against a brick wall. I can get oracle running and go into create the table. I do not know how to connect to the SQL server.
Thank you
Its not that i am not reading up and trying to do on my own just seem to get know further than i was 4 days ago.
I will need all the luck i can get as Final Year Degree.
|
|
|
|
|
|
i have been to that document but clicked on other links on it but that looks to be the source that i am looking for just so much oracle and .net about out there which is confusing me.
Christian Thank You for the help i will work through that and will let you know how i get on.
You will never know until you give it a go!!!!
|
|
|
|
|
I have done what the link says but i dont seem to get any details back, the following does not copy and paste into SQL*Plus:
Listing 1
DROP TABLE emptab; <br />
CREATE TABLE emptab (empno NUMBER(4) PRIMARY KEY, ename VARCHAR2(10));<br />
INSERT INTO emptab VALUES ( 1, 'Mark');<br />
INSERT INTO emptab VALUES ( 2, 'Roger');<br />
INSERT INTO emptab VALUES ( 3, 'Crook');<br />
COMMIT;
I have typed it several times into the SQL*plus command prompt window but just keep getting SP2-0640: Not connected
below is print screen of walk through.
I take it you cannot post word docs in here.
When i type it in the SQL*plus command prompt window the SQL that is typed just stays on the same line until i get to the end of screen then jumps on to the next line. Is this the problem.
I have entered all the VB.net code in and dont have any errors in the code but i must display the details into some list box at present but and eventually into text boxes. Cant remember how to do this will get last years work out.
-- modified at 5:36 Tuesday 2nd October, 2007
|
|
|
|
|
Hi,
This is going to be a bih question but please if you can help me in any way.
I am building a application that is creating wav files. I have managed to create a wav file but I need to insert a pause in the WAV - a straight line, no sound. but still part of the wav. The code is following:
Dim i As Long
Dim lngLimit As Double
Dim lngDataL, lngDataR As Double
Dim dblDataPt As Double
Dim blnPositive As Boolean
Dim intCycleCount As Integer
Dim lngFileSize As Double
Dim lngSamples As Double
Dim lngDataSize As Double
Dim dblDataSlice As Double
Dim dblWaveTime As Double
Dim dblTotalTime As Double
Dim dblSampleTime As Double
dblFrequency = Frequency
'If dblFrequency > 1000 Then
' intCycles = 100
'Else
' intCycles = 10
'End If
intCycles = CInt(trajanje)
dblWaveTime = 1 / dblFrequency
dblTotalTime = dblWaveTime * intCycles
dblSampleTime = 1 / CDbl(lngSampleRate)
dblDataSlice = (2 * PI) / (dblWaveTime / dblSampleTime)
lngSamples = 0
intCycleCount = 0
blnPositive = True
Do
dblDataPt = System.Math.Sin(lngSamples * dblDataSlice)
If lngSamples > 0 Then
If dblDataPt < 0 Then
blnPositive = False
Else
' Detect Zero Crossing
If Not blnPositive Then
intCycleCount = intCycleCount + 1
If intCycleCount >= intCycles Then Exit Do
blnPositive = True
End If
End If
End If
lngSamples = lngSamples + 1
Loop
'-------------------------------------------------------------------------------
' Bytes 40 - 43 Length of Data Samples * Channels * Bits per Sample / 8
'-------------------------------------------------------------------------------
lngDataSize = lngSamples * intAudioWidth * (intBits / 8)
ReDim Preserve WavArray(0 To 43 + lngDataSize)
WavArray(40) = ExtractByte(lngDataSize, 0)
WavArray(41) = ExtractByte(lngDataSize, 1)
WavArray(42) = ExtractByte(lngDataSize, 2)
WavArray(43) = ExtractByte(lngDataSize, 3)
'-------------------------------------------------------------------------------
' Bytes 04 - 07 Total Length to Follow (Length of File - 8)
'-------------------------------------------------------------------------------
lngFileSize = lngDataSize + 36
WavArray(4) = ExtractByte(lngFileSize, 0)
WavArray(5) = ExtractByte(lngFileSize, 1)
WavArray(6) = ExtractByte(lngFileSize, 2)
WavArray(7) = ExtractByte(lngFileSize, 3)
'-------------------------------------------------------------------------------
' Bytes 44 - End Data Samples
'-------------------------------------------------------------------------------
If intBits = 8 Then
lngLimit = 127
Else
lngLimit = 32767
End If
For i = 0 To lngSamples - 1
If intBits = 8 Then
'-----------------------------------------------------------------------
' 8 Bit Data
'-----------------------------------------------------------------------
' Calculate data point.
dblDataPt = System.Math.Sin(i * dblDataSlice) * lngLimit
lngDataL = Int(dblDataPt * dblVolumeL) + lngLimit
lngDataR = Int(dblDataPt * dblVolumeR) + lngLimit
' Place data point in wave tile.
If intAudioMode = MODE_MONO Then WavArray(i + 44) = ExtractByte(lngDataL, 0)
If intAudioMode = MODE_LR Then 'L+R stereo
WavArray((2 * i) + 44) = ExtractByte(lngDataL, 0)
WavArray((2 * i) + 45) = ExtractByte(lngDataR, 0)
End If
If intAudioMode = MODE_L Then ' L only stereo
WavArray((2 * i) + 44) = ExtractByte(lngDataL, 0)
WavArray((2 * i) + 45) = 0
End If
If intAudioMode = MODE_R Then ' R only stereo
WavArray((2 * i) + 44) = 0
WavArray((2 * i) + 45) = ExtractByte(lngDataR, 0)
End If
Else
'-----------------------------------------------------------------------
' 16 Bit Data
'-----------------------------------------------------------------------
' Calculate data point.
dblDataPt = System.Math.Sin(i * dblDataSlice) * lngLimit
lngDataL = Int(dblDataPt * dblVolumeL)
lngDataR = Int(dblDataPt * dblVolumeR)
' Place data point in wave tile.
If intAudioMode = MODE_MONO Then
WavArray((2 * i) + 44) = ExtractByte(lngDataL, 0)
WavArray((2 * i) + 45) = ExtractByte(lngDataL, 1)
End If
If intAudioMode = MODE_LR Then
WavArray((4 * i) + 44) = ExtractByte(lngDataL, 0)
WavArray((4 * i) + 45) = ExtractByte(lngDataL, 1)
WavArray((4 * i) + 46) = ExtractByte(lngDataR, 0)
WavArray((4 * i) + 47) = ExtractByte(lngDataR, 1)
End If
If intAudioMode = MODE_L Then
WavArray((4 * i) + 44) = ExtractByte(lngDataL, 0)
WavArray((4 * i) + 45) = ExtractByte(lngDataL, 1)
WavArray((4 * i) + 46) = 0
WavArray((4 * i) + 47) = 0
End If
If intAudioMode = MODE_R Then
WavArray((4 * i) + 44) = 0
WavArray((4 * i) + 45) = 0
WavArray((4 * i) + 46) = ExtractByte(lngDataR, 0)
WavArray((4 * i) + 47) = ExtractByte(lngDataR, 1)
End If
End If
Next
this is the function that creates the array. another function just writes the wav as binary writer, and all is good. I get a perfect result; a perfect sine wave. But i need to insert some pauses -SILENCE that is in the WAV.
This is a great challenge for me, maybe it will be for you too.
Please help.
Thank you.
|
|
|
|
|
I'm pretty sure that if you just write a stream of zeros in a 16 bit file or a stream of 127s or 128s in an 8 bit file then you should get no sound. Actually any number as long as it stays the same and doesn't vary should produce no sound.
Basically the loudness of a noise is just the difference between its highest air pressure and its lowest air pressure. When the numbers in a wave file go to the speaker it causes it to push something back and forth depending on what the number is and this vibration creates the noise. And all a microphone does is record air pressure at a given moment in time.
|
|
|
|
|
i have been looking for a way to find the number of files in a folder and if there is more the n
number of files in that folder delete the oldest ones. i have fount a way to count the number of
files in the folder, but i am not having any look in finding something to help me in deleting the
oldest files. any guidance would be helpful.
I'm using Vb.net 2.0.
|
|
|
|
|
Above your code write Imports System.IO . Then check out the possibilities of File (File.Exists, File.GetCreationTime, etc)
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
this line gets the count System.IO.Directory.GetFiles("c:\").Length
|
|
|
|
|
i had already fount a way to do this but this is alot simpler. So thanks
|
|
|
|
|
You can have a function which will find the oldest file in a given directory and then you may delete it.
Call this function in a loop while System.IO.Directory.GetFiles("Path").Length>n.
Following is such a small function which finds the oldest file at the given path and removes it –
-------------------Start Code--------------
Private Sub RemoveOldFiles()
Dim str() As String
str = System.IO.Directory.GetFiles("Path")
Dim d As Date
Dim oldfile As String
d = Now()
For Each fl As String In System.IO.Directory.GetFiles("Path")
If d > System.IO.File.GetCreationTime(fl) Then
oldfile = fl
d = System.IO.File.GetCreationTime(fl)
End If
Next
System.IO.File.Delete(oldfile)
End Sub
--------------End Sub-------------------
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Thanks
this is just what i needed. it works perfectly for what i need
|
|
|
|
|
Hi I have a column that should only allow the user to enter in integer values in the range 0-100. Only integers. How do I do this and where would I need to put the code.
Mr oizo
|
|
|
|
|
<edititemtemplate>
<asp:label id="retailCBEditLbl" text="<%# Convert.ToDouble(DataBinder.Eval(Container.DataItem, "AmexRetailCB")).ToString("C")%>" runat="server">
<asp:textbox id="retailCBEditTxt" runat="server" width="50" text="<%# Convert.ToDouble(DataBinder.Eval(Container.DataItem, "AmexRetailCB")).ToString%>" maxlength="11">
<asp:requiredfieldvalidator id="Req1" runat="server" controltovalidate="retailCBEditTxt" errormessage="You must enter Retail CB amount." display="None">
<asp:regularexpressionvalidator enabled="true" id="RegEx1" runat="server" display="None" controltovalidate="retailCBEditTxt" errormessage="Please enter only numbers in currency format for Retail CB amount." validationexpression="^(-)?\d+(\.\d\d)?$">
Replace the resular expression to an expression that only accepts numeric (^([0-9]*|\d*\d{1}?\d*)$)
To allow only 0-100 use a custome validator just like regex and validate in code behind.
Hope this helps
|
|
|
|
|
<EditItemTemplate>
<asp:Label ID="retailCBEditLbl" Text='<%# Convert.ToDouble(DataBinder.Eval(Container.DataItem, "AmexRetailCB")).ToString("C")%>' Runat="server" /><br />
<asp:textbox id ="retailCBEditTxt" runat="server" width="50" Text='<%# Convert.ToDouble(DataBinder.Eval(Container.DataItem, "AmexRetailCB")).ToString%>' maxlength="11" ></asp:textbox>
<asp:requiredfieldvalidator id="Req1" runat="server" controltovalidate="retailCBEditTxt" errormessage="You must enter Retail CB amount." display="None"></asp:requiredfieldvalidator>
<asp:regularexpressionvalidator enabled="true" id="RegEx1" runat="server" display="None" controltovalidate="retailCBEditTxt" errormessage="Please enter only numbers in currency format for Retail CB amount." validationexpression="^(-)?\d+(\.\d\d)?$" ></asp:regularexpressionvalidator>
</EditItemTemplate>
Sorry about the earlier message, here you go
|
|
|
|
|
Hi,
we use a ListView control in order to show thumbnails. After we add some thumbnails, we need to know which thumbnail(ListViewItem is selected or clicked/selected with the mouse) and for this we use ListView1_SelectedIndexChanged event. To know that, we want to know the slected index of the ListView so we use the .SelectedIndices(0) method, but it gets an exception error as shown below.
Private Sub ListView1_SelectedIndexChanged(ByVal .....)
Dim index as Integer
index = ListView1.SelectedIndices(0)
End Sub
- ex {"InvalidArgument=Value of '0' is not valid for 'index'.
Parameter name: index"} System.Exception
Any idea how to retrieve the index of the selected ListViewItem?
|
|
|
|
|
You first have to check if SelectedIndices contains anything at all. The SelectedIndexChanged event is also triggered when the previously selected item is unselected, and then no item is selected and the collection is empty.
---
single minded; short sighted; long gone;
|
|
|
|
|
I am having a page1,page2,page3 in a form .in that i am having a controls . I want to save it into .xml file and i want to retrieve the same order of the form and their properties .IS it possible or not through dataset and has to store in .xml file ??
|
|
|
|
|
It's possible to use a DataSet, but you have to populate the DataSet, or any other container, yourself. The ControlsCollection class is not seriablize, not are the controls it contains.
Your code has to examine each control and pick out the properties you want, then save that information in the DataSet or other container.
You might want to check out this blog post[^] for an example of Dynamic Control Creation from an XML file. It does NOT show you how to serialize the controls to make the file though.
Combine what you see in that post with Reflection and XML documents and you should be able to put together a solution. BTW, a DataSet will not help you much.
|
|
|
|
|
Can we get the properties of form Consider controls in xml format for example like this of form controls for multiple pages . or custom properties into xml file using datasets .
<Pages xmlns=""><br />
- <Page PageNo="1"><br />
<PageName>Page1</PageName> <br />
<PageSize>3</PageSize> <br />
<PageOrientation>0</PageOrientation> <br />
<PagePicture /> <br />
<PageNoPicture>false</PageNoPicture> <br />
<PageAllPages>false</PageAllPages> <br />
<PageDesignOnly>false</PageDesignOnly> <br />
- <PageBorder><br />
<BorderLeft>0.75</BorderLeft> <br />
<BorderTop>0.75</BorderTop> <br />
<BorderHeight>0.75</BorderHeight> <br />
<BorderWidth>0.75</BorderWidth> <br />
<BorderPattern>1</BorderPattern> <br />
</PageBorder><br />
- <txt:TextBox TextIndex="1"><br />
<txt:TextName>Text1</txt:TextName> <br />
<txt:TextAlign>0</txt:TextAlign> <br />
<txt:Appearance>1</txt:Appearance> <br />
<txt:TextBackColor>-2147483643</txt:TextBackColor> <br />
<txt:TextForeColor>-2147483640</txt:TextForeColor> <br />
<txt:TextBorderStyle>1</txt:TextBorderStyle> <br />
<txt:TextText>Text1</txt:TextText> <br />
- <fn:Font><br />
<fn:FontName>MS Sans Serif</fn:FontName> <br />
- <fn:FontStyle><br />
<fn:Bold>false</fn:Bold> <br />
<fn:Italic>false</fn:Italic> <br />
</fn:FontStyle><br />
<fn:FontSize>8</fn:FontSize> <br />
<fn:FontUnderline>false</fn:FontUnderline> <br />
<fn:FontStrikeout>false</fn:FontStrikeout> <br />
</fn:Font><br />
<txt:TextToolTip /> <br />
- <pos:Position><br />
<pos:Left>1935</pos:Left> <br />
<pos:Top>1560</pos:Top> <br />
<pos:Height>315</pos:Height> <br />
<pos:Width>1605</pos:Width> <br />
</pos:Position><br />
<txt:TextLocked>false</txt:TextLocked> <br />
<txt:TextMaxLen>255</txt:TextMaxLen> <br />
<txt:TextMinLen>0</txt:TextMinLen> <br />
<txt:TextMultiline>false</txt:TextMultiline> <br />
<txt:TextDataType>0</txt:TextDataType> <br />
<txt:TextFormat /> <br />
<txt:IsIndexField>True</txt:IsIndexField> <br />
</txt:TextBox><br />
- <txt:TextBox TextIndex="2"><br />
<txt:TextName>Text2</txt:TextName> <br />
<txt:TextAlign>0</txt:TextAlign> <br />
<txt:Appearance>1</txt:Appearance> <br />
<txt:TextBackColor>-2147483643</txt:TextBackColor> <br />
<txt:TextForeColor>-2147483640</txt:TextForeColor> <br />
<txt:TextBorderStyle>1</txt:TextBorderStyle> <br />
<txt:TextText>Text2</txt:TextText> <br />
- <fn:Font><br />
<fn:FontName>MS Sans Serif</fn:FontName> <br />
- <fn:FontStyle><br />
<fn:Bold>false</fn:Bold> <br />
<fn:Italic>false</fn:Italic> <br />
</fn:FontStyle><br />
<fn:FontSize>8</fn:FontSize> <br />
<fn:FontUnderline>false</fn:FontUnderline> <br />
<fn:FontStrikeout>false</fn:FontStrikeout> <br />
</fn:Font><br />
<txt:TextToolTip /> <br />
- <pos:Position><br />
<pos:Left>1965</pos:Left> <br />
<pos:Top>2085</pos:Top> <br />
<pos:Height>315</pos:Height> <br />
<pos:Width>1605</pos:Width> <br />
</pos:Position><br />
<txt:TextLocked>false</txt:TextLocked> <br />
<txt:TextMaxLen>255</txt:TextMaxLen> <br />
<txt:TextMinLen>0</txt:TextMinLen> <br />
<br />
<txt:TextFormat /> <br />
<txt:IsIndexField>False</txt:IsIndexField> <br />
</txt:TextBox><br />
- <txt:TextBox TextIndex="3"><br />
<txt:TextName>Text3</txt:TextName> <br />
<txt:TextAlign>0</txt:TextAlign> <br />
<txt:Appearance>1</txt:Appearance> <br />
<txt:TextBackColor>-2147483643</txt:TextBackColor> <br />
<br />
<txt:TextBorderStyle>1</txt:TextBorderStyle> <br />
<txt:TextText>Text3</txt:TextText> <br />
- <fn:Font><br />
<fn:FontName>MS Sans Serif</fn:FontName> <br />
- <fn:FontStyle><br />
<fn:Bold>false</fn:Bold> <br />
<fn:Italic>false</fn:Italic> <br />
<br />
- <pos:Position><br />
<pos:Left>2925</pos:Left> <br />
<pos:Top>4935</pos:Top> <br />
<pos:Height>315</pos:Height> <br />
<pos:Width>1605</pos:Width> <br />
</pos:Position><br />
<txt:TextLocked>false</txt:TextLocked> <br />
<txt:TextMaxLen>255</txt:TextMaxLen> <br />
<txt:TextMinLen>0</txt:TextMinLen> <br />
<txt:TextMultiline>false</txt:TextMultiline> <br />
<txt:TextDataType>0</txt:TextDataType> <br />
<txt:TextFormat /> <br />
<txt:IsIndexField>True</txt:IsIndexField> <br />
</txt:TextBox><br />
- <chk:CheckBox ChkBoxIndex="1"><br />
<chk:ChkBoxName>Checkbox1</chk:ChkBoxName> <br />
<chk:ChkBoxAlign>0</chk:ChkBoxAlign> <br />
<chk:ChkBoxAppearance>1</chk:ChkBoxAppearance> <br />
<chk:ChkBoxBackColor>16777215</chk:ChkBoxBackColor> <br />
<chk:ChkBoxCaption>Checkbox1</chk:ChkBoxCaption> <br />
- <fn:Font><br />
<fn:FontName>MS Sans Serif</fn:FontName> <br />
- <fn:FontStyle><br />
<fn:Bold>false</fn:Bold> <br />
<fn:Italic>false</fn:Italic> <br />
</fn:FontStyle><br />
<fn:FontSize>8</fn:FontSize> <br />
<fn:FontUnderline>false</fn:FontUnderline> <br />
<fn:FontStrikeout>false</fn:FontStrikeout> <br />
</fn:Font><br />
<chk:ChkBoxForeColor>-2147483630</chk:ChkBoxForeColor> <br />
- <pos:Position><br />
<pos:Left>2280</pos:Left> <br />
<pos:Top>3180</pos:Top> <br />
<pos:Height>285</pos:Height> <br />
<pos:Width>1395</pos:Width> <br />
</pos:Position><br />
<chk:ChkBoxToolTip /> <br />
<chk:ChkBoxDefaultValue>false</chk:ChkBoxDefaultValue> <br />
</chk:CheckBox><br />
</Page><br />
</Pages><br />
</Name>
|
|
|
|
|
You might want to check the little box that says "Ignore HTML tags in this message" before you hit post. Your post is completely unreadable.
But, I think you're question is "Can we get a form to render controls automatically from an XML file??" No. You have to write the code to parse the XML file and create the controls and set the properties one at a time.
|
|
|
|