|
hi all
pls help
I haved used a VLOOKUP to select the field i require, however i need to select all fields that appear in this column and put them in a table. VLOOKUP will only selects the first cell in the column where this data appears. How can i get it to loop round all of them?
veon
|
|
|
|
|
Use the following code as a starting point ...
totalrows = ActiveSheet.UsedRange.Rows.Count
For i = 1 To totalrows
MsgBox(Sheets("Sheet1").Cells(i, 6))
Next i
|
|
|
|
|
hi thanks a lot for the help
is there anyway to copy the data in sheet1 to a new spreadsheet. hmm its like using a code to create a new spreadsheet and generate the data from sheet1 to it. but it only generate selected column not all column is it possible to do it in excel 2000
thanks
veon
|
|
|
|
|
You need to modify a little, the code snippet that David Mujica gave you
Something like that:
totalrows = ActiveSheet.UsedRange.Rows.Count
For i = 1 To totalrows
'MsgBox(Sheets("Sheet1").Cells(i, 6))
Sheets("Sheet2").Cells(i, 6)=Sheets("Sheet1").Cells(i, 6)
'or whatever
Next i
Shay Noy
|
|
|
|
|
Here is a code snipet to create a new workbook from VBA.
Dim Wk As Workbook
Set Wk = Workbooks.Add
Application.DisplayAlerts = False
Wk.SaveAs Filename:="C:\Temp\demosheet.xls"
|
|
|
|
|
hi thanks again my dear friends =)
can i check with you again the code u given me is to create a new workbook or a new spreadsheet. cause i just need a new spreadsheet will do. thanks =))
veon
|
|
|
|
|
To create a new worksheet you can use:
Sheets.Add
|
|
|
|
|
please tel me how i can make four image with x,y resolution , from the input pic of x*2,y*2 image resolution , so if we consider the input image in four pixel squares (two pixel width and two pixe height) the first of output use the first left pixel of four pixel in the square and the second picture use the right top pixel , third use the bottom right, and the fourth use the left bottom ,
i use the setpixel and getpixel method for it, but it is too slow , i think if i use method of changing the image to array it will be very faster, please tel me ho i use the array method.
this is my code in vb.net but too slow :
For y = 0 To picy.Height - 1 Step 2
j = Int(y / 2)
For x = 0 To picy.Width - 1 Step 2
i = Int(x / 2)
pic(0).SetPixel(i, j, picy.GetPixel(x, y))
pic(1).SetPixel(i, j, picy.GetPixel(x + 1, y))
pic(2).SetPixel(i, j, picy.GetPixel(x + 1, y + 1))
pic(3).SetPixel(i, j, picy.GetPixel(x, y + 1))
Next x
Next y
best regards
|
|
|
|
|
Read my articles on image processing. You will need to use C#.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
if all you need the new image for is showing it on screen, you should not spend any time creating such image, just consider using a Graphics.DrawImage with InterpolationMode.NearestNeighbor
to get it completely correct you probably also have to perform a Graphics.Translate() over half a pixel in both x and y!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Wow - I didn't even read the code to see what he was using it for.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I'm not sure what his ultimate purpose is, but it looks like a pixelating viewer, maybe an editor.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
this code used for generating four picture from input one, in half resolution of the source image.
this applied to print machines , in micromovement technology for decreasing the print resolution in the paper exposing of the digital printing machines.
it may be used in 9 from one or 16 from one picture.
|
|
|
|
|
Hi,
I have a question, i need to store the value of richtextbox to MySQL and retrive the value from MYSQL to richtextbox. can you give me a code in vb.net? and will the formating be affected like the font and alignment?
Can you please respond quicky?
|
|
|
|
|
evilson wrote: Can you please respond quicky?
No.
I don't get why people say stuff like that. We're not hired to do your job, we do it for free. You can't give us deadlines on that.
It's just data, did you bother to try storing it and retrieving it, before asking this question ? Why on earth would storing and retrieving it cause the formatting to change ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Sory about that
I tried it but an error appeared during loading saying type byte cannot convert to string. I dont know what to do next. i already stored the content of the rich text box
this is the full code
<br />
<br />
<br />
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
conn = New MySqlConnection()<br />
'connection <br />
myConnString = "connection to server" <br />
conn.ConnectionString = myConnString<br />
conn.Open()<br />
If conn.State = ConnectionState.Closed Then conn.Open()<br />
massDataTable.Clear()<br />
massCommand = New MySqlCommand<br />
massCommand = conn.CreateCommand<br />
massCommand.CommandText = "SELECT * FROM `test` where `mark-1` = 1"<br />
massAdapter.SelectCommand = massCommand<br />
massAdapter.Fill(massDataTable)<br />
With Me<br />
.RichTextBox1.Text = (massDataTable.Rows(0)(1))<br />
End With<br />
End Sub<br />
<br />
|
|
|
|
|
So the correct question is, how do I store a byte[] or how do I convert that to a string, surely ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
If you're a beginner, then perhaps this task is too complex for you. Perhaps you shouldn't be doing paid work at all.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
what you need to save and restore is RichTextBox.Rtf not RichTextBox.Text
Rtf is text+markup; Text is just text.
BTW: why do you choose database field names containing strange characters, as in mark-1? it only makes life difficult without any benefit for anyone.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Before, i use textbox with multiple lines, but my coleauges say they need to do some formating (such as a italicalize headings and underline text and a dozen paragraph), so i use a rich textbox
I name the database field name so it will be easy to remember, but this is just temporary.
|
|
|
|
|
Somehow I think you missed my first point entirely. Anyway look here[^].
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
As Luc said, the reason why the formatting isn't preserved is probably because you're storing the string your getting from the RTB's Text property, when you should be storing the RTB's RTF property instead.
|
|
|
|
|
Hi,
I think you're right. Somehow, i manage to fix the codes and I get what i wanted after doing some research. I'll post the complete codes
And again, thank you for your help
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
With Me<br />
Try<br />
Dim ms As MemoryStream = New MemoryStream<br />
'initializing picture<br />
.RichTextBox1.SaveFile(ms, RichTextBoxStreamType.RichText)<br />
Dim bytBlobData(ms.Length - 1) As Byte<br />
ms.Position = 0<br />
ms.Read(bytBlobData, 0, ms.Length)<br />
<br />
Dim DatabaseParameter As New MySql.Data.MySqlClient.MySqlParameter("@BlobData", MySql.Data.MySqlClient.MySqlDbType.Blob, bytBlobData.Length, ParameterDirection.Input, False, 0, 0, Nothing, DataRowVersion.Current, bytBlobData)<br />
If conn.State = ConnectionState.Closed Then conn.Open()<br />
massCommand = New MySqlCommand<br />
massCommand = conn.CreateCommand<br />
massCommand.CommandText = "insert into `test`" & _<br />
"(`mark-2` ) " & _<br />
"values(@BlobData)"<br />
massCommand.Parameters.Add(DatabaseParameter)<br />
massCommand.ExecuteNonQuery()<br />
Catch ex As Exception<br />
writelog("0001", userid, Now.Date.ToString("MM/dd/yyyy"), Microsoft.VisualBasic.Left(Now.TimeOfDay.ToString, 8), "TEST")<br />
Exit Sub<br />
End Try<br />
End With<br />
End Sub<br />
<br />
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
conn = New MySqlConnection()<br />
'connection <br />
myConnString = "server connection"<br />
conn.ConnectionString = myConnString<br />
conn.Open()<br />
If conn.State = ConnectionState.Closed Then conn.Open()<br />
massDataTable.Clear()<br />
massCommand = New MySqlCommand<br />
massCommand = conn.CreateCommand<br />
massCommand.CommandText = "SELECT * FROM `test` where `mark-1` = 3"<br />
massAdapter.SelectCommand = massCommand<br />
massAdapter.Fill(massDataTable)<br />
With Me<br />
Dim rtfcontent As Byte() = DirectCast(massDataTable.Rows(0)(1), Byte())<br />
If Not rtfcontent Is Nothing Then<br />
Using stream As New IO.MemoryStream(rtfcontent)<br />
.RichTextBox1.LoadFile(stream, RichTextBoxStreamType.RichText)<br />
End Using<br />
End If<br />
End With<br />
End Sub<br />
<br />
|
|
|
|
|
How To Store String As ComboBox's ItemData .
e.g
Dim strSQL as string
strSQL = "select IISC, BRANCH FROM RTGS_BRANCHES"
Set RS = Conn.Execute(strSQL)
Do While Not RS.EOF
cboBankBranch.AddItem RS!BRANCH ' string banch name
cboBankBranch.ItemData(cboBankBranch.NewIndex) = rs!IISC ' is alphanumeric code
rs.movenext
loop
rs.close
here when we assign IISC code as string then its giving error while if it an integer then its working fine. Where i am doing mistake ? Please find out the solution. its urgent.
thanx
Nadeem
|
|
|
|