|
What's the full path to file file your trying to write?? There are certain sections (subdirectories) of the file system that normal users cannot write to, so your code should not be attempting to write to files in these sections.
Keep in mind that any code you launch impersonates you, inheriting your security context. In other words, if your user ID doesn't give you permissions to write a file to a directory, any application you launch won't magically get those permissions.
|
|
|
|
|
I had a simple report containing all data in "details". I need to move some fields from the "details" and have them appear in the "page footer". Simple....
I moved them. Now I have about 1/2-inch of white space between the details and the page footer.
I've already done all the "suppress" checkbox on all unused sections, and I've shrunken the size in the designer of all unused sections. There has to be a setting somewhere that is telling Crystal to render 1/2-inch worth of white space between the details and page footer sections, but I just can't find it!
Thanks,
sindhu
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
Hi all,
I have a image that is converted into a hex string (note see below). I would like to convert this hex string back into the image. How can I start with this? Can someone point me out in accomplishing this?
Thank you very much.
Here under you can find 'a part of' the hex string.
FFD8FFE000104A46494600010100000100010000FFFE002A496E74...
Edit, i removed the biggest part of the hex string because i doesn't look right in this forum. But you can get an idea how it looks like.
|
|
|
|
|
I think i have found it. Searching hard and trying end up with nothing, asking help and the answers suddenly comes.
O well, here i'll give you the solution. (Remind that the hex value is just a part of whole string)
<br />
Private Sub ConvertImg()<br />
Dim hexvalue As String = "FFD8FFE000104A46494600010101000100010000..."<br />
Dim bytevalue As Byte() = HexToBin(hexvalue)<br />
Dim myFileStream As FileStream<br />
Dim intByte As Integer = 0<br />
Dim lngLoop As Long<br />
<br />
Try<br />
intByte = bytevalue.Length<br />
myFileStream = File.OpenWrite("c:\image.jpg")<br />
<br />
For lngLoop = 0 To intByte - 1<br />
myFileStream.WriteByte(bytevalue(lngLoop))<br />
Next<br />
<br />
myFileStream.Close()<br />
Catch ex As IOException<br />
MessageBox.Show(ex.Message)<br />
End Try<br />
End Sub<br />
<br />
<br />
'---------------------------------------------------------------------------<br />
'<br />
' Function: HexToBin()<br />
' Input: s<br />
' Return: bytes<br />
' Purpose: Converts Hex to binary<br />
' <br />
'---------------------------------------------------------------------------<br />
Public Shared Function HexToBin(ByVal s As String) As Byte()<br />
Dim arraySize As Integer = CInt(s.Length / 2)<br />
Dim bytes(arraySize - 1) As Byte<br />
Dim counter As Integer<br />
For i As Integer = 0 To s.Length - 1 Step 2<br />
Dim hexValue As String = s.Substring(i, 2)<br />
<br />
' Tell convert to interpret the string as a 16 bit hex value <br />
Dim intValue As Integer = Convert.ToInt32(hexValue, 16)<br />
' Convert the integer to a byte and store it in the array <br />
bytes(counter) = Convert.ToByte(intValue)<br />
counter += 1<br />
Next<br />
Return bytes<br />
End Function<br />
|
|
|
|
|
Yes, your hex data smells like a JPEG image.
There is no need to write it to disk, you could use a MemoryStream instead.
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,
Just started vb 2005
I need to load items from an 2 dim array in a listbox, then select items in to another listbox , put the selected values in an array and calculate the totals and display it in a txtbox. If I delete an item in de 2° listbox this should also be re calculated.
This is what i have so far .
The result should be something like :
1 pincet 3 $
3 mascara 12 $
youre total amount is 15 $
Public Class Form1
Dim aThings(3, 1) As String
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
aThings(0, 0) = "Mascara 4$"
aThings(0, 1) = 4
aThings(1, 0) = "Lipstick 5 $"
aThings(1, 1) = 5
aThings(2, 0) = "Nivea 3 $"
aThings(2, 1) = 2
aThings(3, 0) = "Pincet 3 $"
aThings(3, 1) = 3
For i As Integer = 0 To 3
LstThings.Items.Add(aThings(i, 0))
Next
End Sub
Private Sub BtnAdd_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles BtnAdd.Click
LstSelecThings.Items.Add(LstThings.SelectedItem.ToString)
End Sub
Private Sub BtnRemove_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles BtnRemove.Click
LstSelecThings.Items.Remove(LstSelecThings.SelectedItem)
End Sub
End Class
|
|
|
|
|
Hi,
rather than adding string to LstSelecThings, you'd better add aThings items to it.
You then could create a calculate() method that iterates over all its items and
sums their value.
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.
|
|
|
|
|
ok , i'll try.
Pattyn.....Belgian ??
|
|
|
|
|
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.
|
|
|
|
|