Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
V

valiovalio

@valiovalio
About
Posts
21
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • list files in directory ordered by creation time
    V valiovalio

    hello, I`m using this code, but it return files in alphabetic order, I need to list those files in date modified order. string winDir = "../katalogas"; try { string[] files = Directory.GetFiles(winDir); foreach (string fileName in files) { // // } } catch (IOException ex) { MessageBox.Show("Klaida! Nerandamas formų katalogas." + ex.Message); Close(); } }

    C#

  • Removing components from controls
    V valiovalio

    now it`s working, thank you very much.

    C#

  • Removing components from controls
    V valiovalio

    Hello, in runtime I create compoments (labels, checkboxs) later I want to clear those, but method that i`m using remove only half of them. Here is that method: foreach (Control ctrl in Controls) { if (ctrl is Label) { Controls.Remove(ctrl); } }

    C#

  • problems with INSERT to database
    V valiovalio

    different record every time, for example now it stoped after inserting second record: in table kodas is nvarchar 100; liga is nvarcha 150; INSERT INTO TLK (kodas, liga) VALUES ('A69.9', 'Spirochetu sukelta infekcija, nepatikslinta') INSERT INTO TLK (kodas, liga) VALUES ('A70', 'Papugu chlamidiju infekcija') INSERT INTO TLK (kodas, liga) VALUES ('A70-A74', 'Kitos chlamidiju sukeltos ligos')

    C# database help question graphics security

  • problems with INSERT to database
    V valiovalio

    Hi, I want to insert into my database some information, I have everything in file a.txt: INSERT INTO TLK (kodas, liga) VALUES ('(01-99)', 'Traumu priežastys (ne iš TLK10 klasifikacijos)') INSERT INTO TLK (kodas, liga) VALUES ('01-99', 'Ne TLK10 traumu priežasciu klasifikacija') INSERT INTO TLK (kodas, liga) VALUES ('1', 'Transporto ivykis') a.txt contains about 10 000 records. I run this program, but everytime it breaks, it shows error that data would be truncated... how can I fix that? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace Kikilis { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string eilute; int id = 0; StringBuilder errorMessages = new StringBuilder(); private void button1_Click(object sender, EventArgs e) { try { System.IO.StreamReader sr = new System.IO.StreamReader("a.txt"); eilute = sr.ReadLine(); string j = "Data Source=KOMPAS;Initial Catalog=MEDIS;Integrated Security=True"; SqlConnection c = new SqlConnection(j); c.Open(); while (eilute != "" || eilute == null) { SqlCommand cmd = new SqlCommand(eilute, c); cmd.ExecuteNonQuery(); cmd.Dispose(); eilute = sr.ReadLine(); } c.Close(); } catch (SqlException ex) { for (int i = 0; i < ex.Errors.Count; i++) { errorMessages.Append("Index #" + i + "\n" + "Message: " + ex.Errors[i].Message + "\n" + "LineNumber: " + ex.Errors[i].LineNumber + "\n" + "Source: " + ex.Errors[i].Source + "\n" + "Procedure: " + ex.Errors[i].Procedure + "\n"); } Console.WriteLine(errorMessages.ToString()); } } } }

    C# database help question graphics security

  • component property
    V valiovalio

    Sorry everything is now working:) thank you very much

    C#

  • component property
    V valiovalio

    First of all thank you for your answer, but I get this error An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Control.Controls.get'

    C#

  • component property
    V valiovalio

    Hi, how I can acces properties of component I created: I create 2 label in my form1, and later I want to get text from each of those labels I think it should look like this foreach(Label l in Form1.label) { console.write(l.text); } but I`m wrong...

    C#

  • list all tables names in combobox
    V valiovalio

    thank You:)

    Database tutorial

  • list all tables names in combobox
    V valiovalio

    Hi, I want to list all tables names in combobox. Can somebody write a code example. Thank you:)

    Database tutorial

  • problems connecting to local database
    V valiovalio

    I don`t think it`s a problem with connection string... I`m not able to connect no mathet what I write in that connection string...

    C# database csharp visual-studio graphics security

  • problems connecting to local database
    V valiovalio

    You meant 'AttachDbFilename=db.mdf;'?

    C# database csharp visual-studio graphics security

  • problems connecting to local database
    V valiovalio

    Hi, I`m using visual studio 2005. I`ve created a local database "db.mdf", and I`m just trying to connect with, but when I run code it throws an exception: ServerVersion = 'sqlconn.ServerVersion' threw an exception of type 'System.InvalidOperationException' and after that the program stops to respond...What should I do to connect? here is my code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace DB { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string c = "Data Source=(local);database=db.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; SqlConnection sqlconn = new SqlConnection(c); sqlconn.Open(); string query = "SELECT ASM_VARDAS, ASM_PAVARDE, ASM_GIM_DATA FROM v_ASMENYS WHERE ASM_AK = "; SqlCommand sqlcomm = new SqlCommand(query, sqlconn); SqlDataReader reader = sqlcomm.ExecuteReader(); reader.Read(); } } }

    C# database csharp visual-studio graphics security

  • image doesn`t fit to screen
    V valiovalio

    I display image in usual way, so I do have a big problem:( unless there is, maybe some way to shrink that image or something... Or what should I do? Maybe there is something I can do while scaning image, setting some properties...? I just don`t know what to do, I need to open image in real size. Maybe you can suggest something? Thanks:)

    C# question

  • image doesn`t fit to screen
    V valiovalio

    string kelias; Bitmap image1; kelias = OpenFile(); image1 = new Bitmap(@kelias, true); // how to set the size in centimetres? } //----------------------------------------------------------------- private string OpenFile() { OpenFileDialog dlgOpenFile = new OpenFileDialog(); dlgOpenFile.ShowReadOnly = true; if (dlgOpenFile.ShowDialog() == DialogResult.OK) { string path = dlgOpenFile.FileName; return path; } return null; }

    C# question

  • image doesn`t fit to screen
    V valiovalio

    hello, I have an image with properties: Size: 1520 x 2234 pixels DPI = 200; size in centimetres: 19.3 x 28.4 cm When I open that image, it doesn`t fit to my 17' screen:( That image fits with size in centimetres. Is it possible to open that picture with size in centimetres, but not in pixels? Arnas

    C# question

  • Image properties
    V valiovalio

    Thanks, You very helped me.

    C# graphics

  • Image properties
    V valiovalio

    Hello, I`m scaned a picture and set the size height 10cm width 10cm, now when I load that picture, I can`t find these parameters, I can only find number of pixels, but nothing about size in centimetres. sring path; Bitmap image1; path= OpenFile(); image1 = new Bitmap(@path, true); } //--------------------------------------- private string OpenFile() { OpenFileDialog dlgOpenFile = new OpenFileDialog(); dlgOpenFile.ShowReadOnly = true; if (dlgOpenFile.ShowDialog() == DialogResult.OK) { string path = dlgOpenFile.FileName; return path; } return null; }

    C# graphics

  • Drag and drop
    V valiovalio

    Thanks;) now it work:)

    C# help question

  • Drag and drop
    V valiovalio

    Hello, I`m trying to create label and then I`m trying to move it on the form, but when I drag label I see two labels instead of one. what should I do to fix it? bool a; Label l; private void button1_Click(object sender, EventArgs e) { l = new Label(); l.Text = "text"; Controls.Add(l); l.MouseDown += new System.Windows.Forms.MouseEventHandler(mouse_down); l.MouseUp += new System.Windows.Forms.MouseEventHandler(mouse_up); l.MouseMove += new System.Windows.Forms.MouseEventHandler(mouse_move); Form1.ActiveForm.AllowDrop = true; } private void mouse_down(object sender, MouseEventArgs e) { a = true; } private void mouse_up(object sender, MouseEventArgs e) { a = false; } private void mouse_move(object sender, MouseEventArgs e) { if (a) { l.Location = e.Location; } } arnas

    C# help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups